Skip to content

Commit 08ef966

Browse files
committed
Append
1 parent aa6237d commit 08ef966

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

MoreLinq.Test/AppendTest.cs

+11-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class AppendTest
2828
[Test]
2929
public void AppendWithNonEmptyHeadSequence()
3030
{
31-
var head = new[] { "first", "second" };
31+
using var head = TestingSequence.Of("first", "second");
3232
var tail = "third";
3333
var whole = head.Append(tail);
3434
whole.AssertSequenceEqual("first", "second", "third");
@@ -37,7 +37,7 @@ public void AppendWithNonEmptyHeadSequence()
3737
[Test]
3838
public void AppendWithEmptyHeadSequence()
3939
{
40-
string[] head = [];
40+
using var head = TestingSequence.Of<string>();
4141
var tail = "first";
4242
var whole = head.Append(tail);
4343
whole.AssertSequenceEqual("first");
@@ -46,7 +46,7 @@ public void AppendWithEmptyHeadSequence()
4646
[Test]
4747
public void AppendWithNullTail()
4848
{
49-
var head = new[] { "first", "second" };
49+
using var head = TestingSequence.Of("first", "second");
5050
string? tail = null;
5151
var whole = head.Append(tail);
5252
whole.AssertSequenceEqual("first", "second", null);
@@ -82,12 +82,15 @@ into e
8282
[Test]
8383
public void AppendWithSharedSource()
8484
{
85-
var first = new[] { 1 }.Append(2);
86-
var second = first.Append(3).Append(4);
87-
var third = first.Append(4).Append(8);
85+
using var a = new[] { 1 }.AsTestingSequence(maxEnumerations: 2);
86+
using var b = a.Append(2).AsTestingSequence(maxEnumerations: 2);
87+
using var c = b.Append(3).AsTestingSequence();
88+
using var d = c.Append(4).AsTestingSequence();
89+
using var e = b.Append(4).AsTestingSequence();
90+
using var f = e.Append(8).AsTestingSequence();
8891

89-
second.AssertSequenceEqual(1, 2, 3, 4);
90-
third.AssertSequenceEqual(1, 2, 4, 8);
92+
d.AssertSequenceEqual(1, 2, 3, 4);
93+
f.AssertSequenceEqual(1, 2, 4, 8);
9194
}
9295
}
9396
}

0 commit comments

Comments
 (0)