[ci skip] Assert that null throws

This commit is contained in:
Oliver Booth 2022-04-21 21:41:58 +01:00
parent e88494fae4
commit 7086d36faa
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
1 changed files with 15 additions and 1 deletions

View File

@ -1,4 +1,4 @@
using System.Net;
using System.Net;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using X10D.Net;
@ -7,6 +7,20 @@ namespace X10D.Tests.Net;
[TestClass]
public class EndPointTests
{
[TestMethod]
public void GetHost_Null_ShouldThrow()
{
Assert.ThrowsException<ArgumentNullException>(() => ((IPEndPoint?)null)!.GetHost());
Assert.ThrowsException<ArgumentNullException>(() => ((DnsEndPoint?)null)!.GetHost());
}
[TestMethod]
public void GetPort_Null_ShouldThrow()
{
Assert.ThrowsException<ArgumentNullException>(() => ((IPEndPoint?)null)!.GetPort());
Assert.ThrowsException<ArgumentNullException>(() => ((DnsEndPoint?)null)!.GetPort());
}
[TestMethod]
public void DnsEndPoint_GetHost_Localhost()
{