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

Add unsupported EndPoint tests

Satisfies 100% coverage
This commit is contained in:
Oliver Booth 2022-04-24 10:48:16 +01:00
parent 199b82b9a6
commit 2c2de1e30e
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634

View File

@ -22,37 +22,55 @@ public class EndPointTests
} }
[TestMethod] [TestMethod]
public void DnsEndPointGetHostLocalhost() public void DnsEndPointGetHostShouldBeLocalhost()
{ {
var endPoint = new DnsEndPoint("localhost", 1234); var endPoint = new DnsEndPoint("localhost", 1234);
Assert.AreEqual("localhost", endPoint.GetHost()); Assert.AreEqual("localhost", endPoint.GetHost());
} }
[TestMethod] [TestMethod]
public void DnsEndPointGetPort1234() public void DnsEndPointGetPortShouldBe1234()
{ {
var endPoint = new DnsEndPoint("localhost", 1234); var endPoint = new DnsEndPoint("localhost", 1234);
Assert.AreEqual(1234, endPoint.GetPort()); Assert.AreEqual(1234, endPoint.GetPort());
} }
[TestMethod] [TestMethod]
public void IPEndPointIPv4LoopbackGetHost127001() public void IPEndPointIPv4LoopbackGetHostShouldBe127_0_0_1()
{ {
var endPoint = new IPEndPoint(IPAddress.Loopback, 1234); var endPoint = new IPEndPoint(IPAddress.Loopback, 1234);
Assert.AreEqual("127.0.0.1", endPoint.GetHost()); Assert.AreEqual("127.0.0.1", endPoint.GetHost());
} }
[TestMethod] [TestMethod]
public void IPEndPointIPv6LoopbackGetHostColonColon1() public void IPEndPointIPv6LoopbackGetHostShouldBeColonColon1()
{ {
var endPoint = new IPEndPoint(IPAddress.IPv6Loopback, 1234); var endPoint = new IPEndPoint(IPAddress.IPv6Loopback, 1234);
Assert.AreEqual("::1", endPoint.GetHost()); Assert.AreEqual("::1", endPoint.GetHost());
} }
[TestMethod] [TestMethod]
public void IPEndPointGetPort1234() public void IPEndPointGetPortShouldBe1234()
{ {
var endPoint = new IPEndPoint(IPAddress.Loopback, 1234); var endPoint = new IPEndPoint(IPAddress.Loopback, 1234);
Assert.AreEqual(1234, endPoint.GetPort()); Assert.AreEqual(1234, endPoint.GetPort());
} }
[TestMethod]
public void DummyEndPointGetHostShouldBeEmptyString()
{
var endPoint = new DummyEndPoint();
Assert.AreEqual(string.Empty, endPoint.GetHost());
}
[TestMethod]
public void DummyEndPointGetPortShouldBe0()
{
var endPoint = new DummyEndPoint();
Assert.AreEqual(0, endPoint.GetPort());
}
private class DummyEndPoint : EndPoint
{
}
} }