diff --git a/X10D.Tests/src/Collections/SpanTest.cs b/X10D.Tests/src/Collections/SpanTest.cs index 41f3809..106bf80 100644 --- a/X10D.Tests/src/Collections/SpanTest.cs +++ b/X10D.Tests/src/Collections/SpanTest.cs @@ -6,6 +6,26 @@ namespace X10D.Tests.Collections; [TestClass] public class SpanTest { + [TestMethod] + public void Count_ShouldReturn0_GivenEmptySpan() + { + Span span = Span.Empty; + + int count = span.Count(2); + + Assert.AreEqual(0, count); + } + + [TestMethod] + public void Count_ShouldReturn8_GivenSpanWith8MatchingElements() + { + Span span = stackalloc int[16] {1, 2, 3, 2, 5, 2, 7, 2, 9, 2, 11, 2, 13, 2, 15, 2}; + + int count = span.Count(2); + + Assert.AreEqual(8, count); + } + [TestMethod] public void Split_OnEmptySpan_ShouldYieldNothing() {