From 4f3f79194827e143569e461865e798ce9847a1b4 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Thu, 30 Mar 2023 17:49:00 +0100 Subject: [PATCH] [ci skip] test: assert ArgumentNullException from Grep --- X10D.Tests/src/Text/EnumerableTests.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/X10D.Tests/src/Text/EnumerableTests.cs b/X10D.Tests/src/Text/EnumerableTests.cs index 540a121..f498f5c 100644 --- a/X10D.Tests/src/Text/EnumerableTests.cs +++ b/X10D.Tests/src/Text/EnumerableTests.cs @@ -44,6 +44,20 @@ public class EnumerableTests Assert.AreEqual(0, actualResult.Length); } + [TestMethod] + public void Grep_ShouldThrowArgumentNullException_GivenNullPattern() + { + IEnumerable source = Enumerable.Empty(); + Assert.ThrowsException(() => source.Grep(null!)); + } + + [TestMethod] + public void Grep_ShouldThrowArgumentNullException_GivenNullSource() + { + IEnumerable source = null!; + Assert.ThrowsException(() => source.Grep("foo")); + } + [TestMethod] public void Grep_ShouldYieldNoElements_GivenNoMatchingStrings() {