mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-10 02:25:41 +00:00
Add tests for Net.EndPointExtensions
This commit is contained in:
parent
671c08d2e2
commit
b9d5eca364
44
X10D.Tests/src/Net/EndPointTests.cs
Normal file
44
X10D.Tests/src/Net/EndPointTests.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
using System.Net;
|
||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using X10D.Net;
|
||||||
|
|
||||||
|
namespace X10D.Tests.Net;
|
||||||
|
|
||||||
|
[TestClass]
|
||||||
|
public class EndPointTests
|
||||||
|
{
|
||||||
|
[TestMethod]
|
||||||
|
public void DnsEndPoint_GetHost_Localhost()
|
||||||
|
{
|
||||||
|
var endPoint = new DnsEndPoint("localhost", 1234);
|
||||||
|
Assert.AreEqual("localhost", endPoint.GetHost());
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void DnsEndPoint_GetPort_1234()
|
||||||
|
{
|
||||||
|
var endPoint = new DnsEndPoint("localhost", 1234);
|
||||||
|
Assert.AreEqual(1234, endPoint.GetPort());
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void IPEndPoint_IPv4_Loopback_GetHost_127_0_0_1()
|
||||||
|
{
|
||||||
|
var endPoint = new IPEndPoint(IPAddress.Loopback, 1234);
|
||||||
|
Assert.AreEqual("127.0.0.1", endPoint.GetHost());
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void IPEndPoint_IPv6_Loopback_GetHost_ColonColon1()
|
||||||
|
{
|
||||||
|
var endPoint = new IPEndPoint(IPAddress.IPv6Loopback, 1234);
|
||||||
|
Assert.AreEqual("::1", endPoint.GetHost());
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void IPEndPoint_GetPort_1234()
|
||||||
|
{
|
||||||
|
var endPoint = new IPEndPoint(IPAddress.Loopback, 1234);
|
||||||
|
Assert.AreEqual("127.0.0.1", endPoint.GetHost());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user