mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-23 01:18:46 +00:00
[ci skip] Use more meaningful test names for EndPointTests
This commit is contained in:
parent
9a089a9ae2
commit
907687a883
@ -8,63 +8,63 @@ namespace X10D.Tests.Net;
|
|||||||
public class EndPointTests
|
public class EndPointTests
|
||||||
{
|
{
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetHostNullShouldThrow()
|
public void GetHost_ShouldBeLocalhost_GivenLocalhostDnsEndPoint()
|
||||||
{
|
|
||||||
Assert.ThrowsException<ArgumentNullException>(() => ((IPEndPoint?)null)!.GetHost());
|
|
||||||
Assert.ThrowsException<ArgumentNullException>(() => ((DnsEndPoint?)null)!.GetHost());
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void GetPortNullShouldThrow()
|
|
||||||
{
|
|
||||||
Assert.ThrowsException<ArgumentNullException>(() => ((IPEndPoint?)null)!.GetPort());
|
|
||||||
Assert.ThrowsException<ArgumentNullException>(() => ((DnsEndPoint?)null)!.GetPort());
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
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 DnsEndPointGetPortShouldBe1234()
|
public void GetHost_ShouldBe127001_GivenLoopbackIPEndPoint()
|
||||||
{
|
|
||||||
var endPoint = new DnsEndPoint("localhost", 1234);
|
|
||||||
Assert.AreEqual(1234, endPoint.GetPort());
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
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 IPEndPointIPv6LoopbackGetHostShouldBeColonColon1()
|
public void GetHost_ShouldBeColonColon1_GivenIPv6LoopBackIPEndPoint()
|
||||||
{
|
{
|
||||||
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 IPEndPointGetPortShouldBe1234()
|
public void GetHost_ShouldThrow_GivenNull()
|
||||||
|
{
|
||||||
|
Assert.ThrowsException<ArgumentNullException>(() => ((IPEndPoint?)null)!.GetHost());
|
||||||
|
Assert.ThrowsException<ArgumentNullException>(() => ((DnsEndPoint?)null)!.GetHost());
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void GetPort_ShouldBe1234_Given1234IPEndPoint()
|
||||||
{
|
{
|
||||||
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]
|
[TestMethod]
|
||||||
public void DummyEndPointGetHostShouldBeEmptyString()
|
public void GetPort_ShouldBe1234_Given1234DnsEndPoint()
|
||||||
|
{
|
||||||
|
var endPoint = new DnsEndPoint("localhost", 1234);
|
||||||
|
Assert.AreEqual(1234, endPoint.GetPort());
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void GetPort_ShouldThrow_GivenNull()
|
||||||
|
{
|
||||||
|
Assert.ThrowsException<ArgumentNullException>(() => ((IPEndPoint?)null)!.GetPort());
|
||||||
|
Assert.ThrowsException<ArgumentNullException>(() => ((DnsEndPoint?)null)!.GetPort());
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void GetHost_ShouldBeEmpty_GivenInvalidEndPoint()
|
||||||
{
|
{
|
||||||
var endPoint = new DummyEndPoint();
|
var endPoint = new DummyEndPoint();
|
||||||
Assert.AreEqual(string.Empty, endPoint.GetHost());
|
Assert.AreEqual(string.Empty, endPoint.GetHost());
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void DummyEndPointGetPortShouldBe0()
|
public void GetPort_ShouldBe0_GivenInvalidEndPoint()
|
||||||
{
|
{
|
||||||
var endPoint = new DummyEndPoint();
|
var endPoint = new DummyEndPoint();
|
||||||
Assert.AreEqual(0, endPoint.GetPort());
|
Assert.AreEqual(0, endPoint.GetPort());
|
||||||
|
Loading…
Reference in New Issue
Block a user