1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-22 19:28:48 +00:00

[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

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()
{