Skip to content

Commit

Permalink
test: cover null input for IsIPv4 and IsIPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Apr 2, 2023
1 parent 3523ca5 commit 4fc0d01
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions X10D.Tests/src/Net/IPAddressTests.cs
Expand Up @@ -29,6 +29,13 @@ public void IsIPv4_ShouldBeFalse_GivenIPv6()
Assert.IsFalse(_ipv6Address.IsIPv4());
}

[TestMethod]
public void IsIPv4_ShouldThrowArgumentNullException_GivenNullAddress()
{
IPAddress address = null!;
Assert.ThrowsException<ArgumentNullException>(() => address.IsIPv4());
}

[TestMethod]
public void IsIPv6_ShouldBeFalse_GivenIPv4()
{
Expand All @@ -40,4 +47,11 @@ public void IsIPv6_ShouldBeTrue_GivenIPv6()
{
Assert.IsTrue(_ipv6Address.IsIPv6());
}

[TestMethod]
public void IsIPv6_ShouldThrowArgumentNullException_GivenNullAddress()
{
IPAddress address = null!;
Assert.ThrowsException<ArgumentNullException>(() => address.IsIPv6());
}
}

0 comments on commit 4fc0d01

Please sign in to comment.