Skip to content

Commit 3c27f05

Browse files
committed
Add test for FirstOrDefault
1 parent 4aeb86e commit 3c27f05

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/StructLinq.Tests/FirstOrDefaultTests.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public void ShouldReturnDefaultZeroAlloc()
4040
StructEnumerable.Empty<int>().FirstOrDefault(x=>x).Should().Be(default);
4141
}
4242

43-
4443
[Fact]
4544
public void ShouldReturnFirstElementWithFunc()
4645
{
@@ -62,5 +61,16 @@ public void ShouldReturnFirstElementWithFuncZeroAlloc()
6261
.Should()
6362
.Be(6);
6463
}
64+
65+
[Fact]
66+
public void ShouldReturnDefaultValue()
67+
{
68+
var array = Enumerable.Range(0, 10)
69+
.ToArray()
70+
.ToStructEnumerable()
71+
.FirstOrDefault(x => x == 11)
72+
.Should()
73+
.Be(default);
74+
}
6575
}
6676
}

0 commit comments

Comments
 (0)