1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-09 23:15:40 +00:00

test: cover null input for IsIPv4 and IsIPv6

This commit is contained in:
Oliver Booth 2023-04-02 21:59:35 +01:00
parent 3523ca5468
commit 4fc0d01670
No known key found for this signature in database
GPG Key ID: 20BEB9DC87961025

View File

@ -29,6 +29,13 @@ public class IPAddressTests
Assert.IsFalse(_ipv6Address.IsIPv4());
}
[TestMethod]
public void IsIPv4_ShouldThrowArgumentNullException_GivenNullAddress()
{
IPAddress address = null!;
Assert.ThrowsException<ArgumentNullException>(() => address.IsIPv4());
}
[TestMethod]
public void IsIPv6_ShouldBeFalse_GivenIPv4()
{
@ -40,4 +47,11 @@ public class IPAddressTests
{
Assert.IsTrue(_ipv6Address.IsIPv6());
}
[TestMethod]
public void IsIPv6_ShouldThrowArgumentNullException_GivenNullAddress()
{
IPAddress address = null!;
Assert.ThrowsException<ArgumentNullException>(() => address.IsIPv6());
}
}