[ci skip] test: assert ArgumentNullException from Grep

This commit is contained in:
Oliver Booth 2023-03-30 17:49:00 +01:00
parent 12d2e10be4
commit 4f3f791948
No known key found for this signature in database
GPG Key ID: 20BEB9DC87961025
1 changed files with 14 additions and 0 deletions

View File

@ -44,6 +44,20 @@ public class EnumerableTests
Assert.AreEqual(0, actualResult.Length);
}
[TestMethod]
public void Grep_ShouldThrowArgumentNullException_GivenNullPattern()
{
IEnumerable<string> source = Enumerable.Empty<string>();
Assert.ThrowsException<ArgumentNullException>(() => source.Grep(null!));
}
[TestMethod]
public void Grep_ShouldThrowArgumentNullException_GivenNullSource()
{
IEnumerable<string> source = null!;
Assert.ThrowsException<ArgumentNullException>(() => source.Grep("foo"));
}
[TestMethod]
public void Grep_ShouldYieldNoElements_GivenNoMatchingStrings()
{