Exemplo n.º 1
0
 public void TestIpAddress_GetString()
 {
     IIpAddress address = new StubIpAddress()
     {
         IpByte1 = 0,
         IpByte2 = 1,
         IpByte3 = 27,
         IpByte4 = 255
     };
     Assert.AreEqual(address.GetString(), "0.1.27.255");
     address.IpByte2 = 201;
     Assert.AreEqual(address.GetString(), "0.201.27.255");
 }
Exemplo n.º 2
0
 public void TestIpAddress_GetAddress()
 {
     IIpAddress address = new StubIpAddress();
     Assert.AreEqual(address.IpByte1, 0);
     Assert.AreEqual(address.IpByte2, 0);
     Assert.AreEqual(address.IpByte3, 0);
     Assert.AreEqual(address.IpByte4, 0);
     bool result = address.SetAddress("2.201.23.255");
     Assert.IsTrue(result);
     Assert.AreEqual(address.IpByte1, 2);
     Assert.AreEqual(address.IpByte2, 201);
     Assert.AreEqual(address.IpByte3, 23);
     Assert.AreEqual(address.IpByte4, 255);
     result = address.SetAddress("17.17");
     Assert.IsFalse(result);
     Assert.AreEqual(address.IpByte1, 2);
     Assert.AreEqual(address.IpByte2, 201);
     Assert.AreEqual(address.IpByte3, 23);
     Assert.AreEqual(address.IpByte4, 255);
 }