ToString() public method

public ToString ( ) : string
return string
Ejemplo n.º 1
0
		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 ());
		}
Ejemplo n.º 2
0
		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 ());
		}
Ejemplo n.º 3
0
		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 ());
		}