Esempio n. 1
0
        public void Ctor()
        {
            var ipAddress = IPAddress.Parse("192.168.1.123");

            var address = new Address(IpAddress.Parse("192.168.1.123"));

            Assert.AreEqual((byte)192, address.OctetA);
            Assert.AreEqual((byte)168, address.OctetB);
            Assert.AreEqual((byte)1, address.OctetC);
            Assert.AreEqual((byte)123, address.OctetD);

            address = new Address((uint)IpAddress.ReverseBytes((int)ipAddress.Address));

            Assert.AreEqual((byte)192, address.OctetA);
            Assert.AreEqual((byte)168, address.OctetB);
            Assert.AreEqual((byte)1, address.OctetC);
            Assert.AreEqual((byte)123, address.OctetD);
        }
Esempio n. 2
0
 public void ReverseBytes()
 {
     Assert.AreEqual(0x04030201, IpAddress.ReverseBytes(0x01020304));
     Assert.AreEqual((uint)0x04030201, IpAddress.ReverseBytes((uint)0x01020304));
 }