From 7086d36faa1b65378c316e0d4eb3b7b774ab484f Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Thu, 21 Apr 2022 21:41:58 +0100 Subject: [PATCH] [ci skip] Assert that null throws --- X10D.Tests/src/Net/EndPointTests.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/X10D.Tests/src/Net/EndPointTests.cs b/X10D.Tests/src/Net/EndPointTests.cs index 72d511e..8bb38e0 100644 --- a/X10D.Tests/src/Net/EndPointTests.cs +++ b/X10D.Tests/src/Net/EndPointTests.cs @@ -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(() => ((IPEndPoint?)null)!.GetHost()); + Assert.ThrowsException(() => ((DnsEndPoint?)null)!.GetHost()); + } + + [TestMethod] + public void GetPort_Null_ShouldThrow() + { + Assert.ThrowsException(() => ((IPEndPoint?)null)!.GetPort()); + Assert.ThrowsException(() => ((DnsEndPoint?)null)!.GetPort()); + } + [TestMethod] public void DnsEndPoint_GetHost_Localhost() {