Ejemplo n.º 1
0
        public void Is_Ip_Address_In_Range_From_Subnet()
        {
            Assert.That(IpAddress.IsIpAddressInRangeFromSubnet("192.168.167.10", "192.168.167.0", "255.255.255.0"), Is.True);
            Assert.That(IpAddress.IsIpAddressInRangeFromSubnet("192.168.167.240", "192.168.167.0", "255.255.255.0"), Is.True);
            Assert.That(IpAddress.IsIpAddressInRangeFromSubnet("192.168.168.10", "192.168.167.0", "255.255.255.0"), Is.False);
            Assert.That(IpAddress.IsIpAddressInRangeFromSubnet("192.168.168.10", "192.168.167.0", "255.255.255.0"), Is.False);

            Assert.That(IpAddress.IsIpAddressInRangeFromSubnet("192.168.167.10", "192.168.167.0/24"), Is.True);
            Assert.That(IpAddress.IsIpAddressInRangeFromSubnet("192.168.167.240", "192.168.167.0/24"), Is.True);
            Assert.That(IpAddress.IsIpAddressInRangeFromSubnet("192.168.168.10", "192.168.167.0/24"), Is.False);
            Assert.That(IpAddress.IsIpAddressInRangeFromSubnet("192.168.168.10", "192.168.167.0/24"), Is.False);
        }