public void Constructor_StringInt () { Assert.Throws<ArgumentNullException> (delegate { new DnsEndPoint (null, 0); }, "ctor(null,0)"); Assert.Throws<ArgumentException> (delegate { new DnsEndPoint (String.Empty, 0); }, "ctor(Empty,0)"); Assert.Throws<ArgumentOutOfRangeException> (delegate { new DnsEndPoint ("localhost", -1); }, "ctor(localhost,-1)"); Assert.Throws<ArgumentOutOfRangeException> (delegate { new DnsEndPoint ("localhost", (0xffff + 1)); }, "ctor(localhost,(0xffff + 1))"); DnsEndPoint dep = new DnsEndPoint ("localhost", 65535); Assert.AreEqual (AddressFamily.Unspecified, dep.AddressFamily, "AddressFamily"); Assert.AreEqual ("localhost", dep.Host, "Host"); Assert.AreEqual (65535, dep.Port, "Port"); Assert.IsFalse (dep.Equals (null), "Equals(null)"); Assert.IsTrue (dep.Equals (dep), "Equals(self)"); Assert.AreEqual ("Unspecified/localhost:65535", dep.ToString ()); }
public void InterNetwork () { DnsEndPoint dep = new DnsEndPoint ("localhost", 0, AddressFamily.InterNetwork); Assert.AreEqual ("localhost", dep.Host, "Host"); Assert.AreEqual (AddressFamily.InterNetwork, dep.AddressFamily, "AddressFamily"); Assert.AreEqual ("localhost", dep.Host, "Host"); Assert.AreEqual (0, dep.Port, "Port"); Assert.IsFalse (dep.Equals (null), "Equals(null)"); Assert.IsTrue (dep.Equals (dep), "Equals(self)"); Assert.AreEqual ("InterNetwork/localhost:0", dep.ToString ()); }
public void Unspecified () { DnsEndPoint dep = new DnsEndPoint ("localhost", 0, AddressFamily.Unspecified); Assert.AreEqual ("localhost", dep.Host, "Host"); Assert.AreEqual (AddressFamily.Unspecified, dep.AddressFamily, "AddressFamily"); Assert.AreEqual ("localhost", dep.Host, "Host"); Assert.AreEqual (0, dep.Port, "Port"); Assert.IsFalse (dep.Equals (null), "Equals(null)"); Assert.IsTrue (dep.Equals (dep), "Equals(self)"); Assert.AreEqual ("Unspecified/localhost:0", dep.ToString ()); }