mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-09 22:55:42 +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
|
||||
{
|
||||
[TestMethod]
|
||||
public void GetHostNullShouldThrow()
|
||||
{
|
||||
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()
|
||||
public void GetHost_ShouldBeLocalhost_GivenLocalhostDnsEndPoint()
|
||||
{
|
||||
var endPoint = new DnsEndPoint("localhost", 1234);
|
||||
Assert.AreEqual("localhost", endPoint.GetHost());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DnsEndPointGetPortShouldBe1234()
|
||||
{
|
||||
var endPoint = new DnsEndPoint("localhost", 1234);
|
||||
Assert.AreEqual(1234, endPoint.GetPort());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IPEndPointIPv4LoopbackGetHostShouldBe127_0_0_1()
|
||||
public void GetHost_ShouldBe127001_GivenLoopbackIPEndPoint()
|
||||
{
|
||||
var endPoint = new IPEndPoint(IPAddress.Loopback, 1234);
|
||||
Assert.AreEqual("127.0.0.1", endPoint.GetHost());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IPEndPointIPv6LoopbackGetHostShouldBeColonColon1()
|
||||
public void GetHost_ShouldBeColonColon1_GivenIPv6LoopBackIPEndPoint()
|
||||
{
|
||||
var endPoint = new IPEndPoint(IPAddress.IPv6Loopback, 1234);
|
||||
Assert.AreEqual("::1", endPoint.GetHost());
|
||||
}
|
||||
|
||||
[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);
|
||||
Assert.AreEqual(1234, endPoint.GetPort());
|
||||
}
|
||||
|
||||
[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();
|
||||
Assert.AreEqual(string.Empty, endPoint.GetHost());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DummyEndPointGetPortShouldBe0()
|
||||
public void GetPort_ShouldBe0_GivenInvalidEndPoint()
|
||||
{
|
||||
var endPoint = new DummyEndPoint();
|
||||
Assert.AreEqual(0, endPoint.GetPort());
|
||||
|
Loading…
Reference in New Issue
Block a user