Skip to content

Commit

Permalink
Add test for FirstOrDefault
Browse files Browse the repository at this point in the history
  • Loading branch information
mobile46 committed Nov 1, 2023
1 parent 4aeb86e commit 3c27f05
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/StructLinq.Tests/FirstOrDefaultTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public void ShouldReturnDefaultZeroAlloc()
StructEnumerable.Empty<int>().FirstOrDefault(x=>x).Should().Be(default);
}


[Fact]
public void ShouldReturnFirstElementWithFunc()
{
Expand All @@ -62,5 +61,16 @@ public void ShouldReturnFirstElementWithFuncZeroAlloc()
.Should()
.Be(6);
}

[Fact]
public void ShouldReturnDefaultValue()
{
var array = Enumerable.Range(0, 10)
.ToArray()
.ToStructEnumerable()
.FirstOrDefault(x => x == 11)
.Should()
.Be(default);
}
}
}

0 comments on commit 3c27f05

Please sign in to comment.