diff --git a/IntelliTect.Multitool.Tests/Extensions/SystemLinqExtensionsTests.cs b/IntelliTect.Multitool.Tests/Extensions/SystemLinqExtensionsTests.cs new file mode 100644 index 0000000..7b7d4aa --- /dev/null +++ b/IntelliTect.Multitool.Tests/Extensions/SystemLinqExtensionsTests.cs @@ -0,0 +1,16 @@ +using Xunit; + +namespace IntelliTect.Multitool.Extensions.Tests; + +public class SystemLinqExtensionsTests +{ + private static readonly List _stringsWithSomeNullValues = ["Hello", null, "World", null, "!"]; + + [Fact] + public void WhereNotNull_ReturnsOnlyNonNullValues() + { + IEnumerable nonNullableStringType = _stringsWithSomeNullValues.WhereNotNull(); + Assert.All(_stringsWithSomeNullValues.WhereNotNull(), s => Assert.NotNull(s)); + Assert.Equal(["Hello", "World", "!" ], nonNullableStringType); + } +}