diff --git a/MoreLinq.Test/BatchTest.cs b/MoreLinq.Test/BatchTest.cs index bc4bec843..c5c9186e7 100644 --- a/MoreLinq.Test/BatchTest.cs +++ b/MoreLinq.Test/BatchTest.cs @@ -79,6 +79,22 @@ public void BatchSequenceYieldsListsOfBatches() reader.ReadEnd(); } + [Test] + public void BatchSequencesAreIndependentInstances() + { + var result = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }.Batch(4); + + using var reader = result.Read(); + var first = reader.Read(); + var second = reader.Read(); + var third = reader.Read(); + reader.ReadEnd(); + + first.AssertSequenceEqual(1, 2, 3, 4); + second.AssertSequenceEqual(5, 6, 7, 8); + third.AssertSequenceEqual(9); + } + [Test] public void BatchIsLazy() {