Пример #1
0
        public void IsValid_CustomRoute_RandomInvalidMask( )
        {
            var netRoute = new SUTest(
                new NetIpAddress(124, 102, 0, 0),
                new NetIpAddress(255, 255, 0, 1),
                new NetIpAddress(172, 144, 11, 201));

            Assert.AreEqual(false, netRoute.IsValid( ));
        }
Пример #2
0
        public void IsValid_CustomRoute_Default( )
        {
            var netRoute = new SUTest(
                NetIpAddress.Zero,
                NetIpAddress.Zero,
                new NetIpAddress(172, 144, 11, 201));

            Assert.AreEqual(true, netRoute.IsValid( ));
        }
Пример #3
0
        public void Constructor_DefaultRoute( )
        {
            var netRoute = new SUTest(new NetIpAddress(124, 102, 11, 7));

            Assert.AreEqual(true, netRoute.IsDefault);
            CollectionAssert.AreEqual(new byte[] { 124, 102, 11, 7 }, netRoute.Target.Address.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.MaxAddress.Bytes, netRoute.Target.Netmask.Bytes);
            CollectionAssert.AreEqual(new byte[] { 124, 102, 11, 7 }, netRoute.Target.Broadcast.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.Zero.Bytes, netRoute.Address.Address.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.Zero.Bytes, netRoute.Address.Netmask.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.MaxAddress.Bytes, netRoute.Address.Broadcast.Bytes);
        }
Пример #4
0
        public void Constructor_DefaultRoute( )
        {
            var netRoute = new SUTest(new NetIpAddress(124, 102, 11, 7));

            Assert.AreEqual(true, netRoute.IsDefault);
            CollectionAssert.AreEqual(new byte[] { 124, 102, 11, 7 }, netRoute.Target.Address.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.MaxAddress.Bytes, netRoute.Target.Netmask.Bytes);
            CollectionAssert.AreEqual(new byte[] { 124, 102, 11, 7 }, netRoute.Target.Broadcast.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.Zero.Bytes, netRoute.Address.Address.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.Zero.Bytes, netRoute.Address.Netmask.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.MaxAddress.Bytes, netRoute.Address.Broadcast.Bytes);
        }
Пример #5
0
        public void IsMatch_OutsideAfter( )
        {
            var netRoute = new SUTest(
                new NetIpAddress(124, 102, 0, 0),
                new NetIpAddress(255, 255, 0, 0),
                new NetIpAddress(172, 144, 11, 201));

            var netIpAddressOutsideAfter = new NetAddress(
                new NetIpAddress(124, 103, 0, 1),
                new NetIpAddress(255, 255, 0, 0));

            Assert.AreEqual(false, netRoute.IsMatch(netIpAddressOutsideAfter));
        }
Пример #6
0
        public void IsMatch_InsideBeforeOutside( )
        {
            var netRoute = new SUTest(
                new NetIpAddress(124, 102, 0, 0),
                new NetIpAddress(255, 255, 0, 0),
                new NetIpAddress(172, 144, 11, 201));

            var netIpAddressInsideBeforeOutside = new NetAddress(
                new NetIpAddress(124, 102, 255, 255),
                new NetIpAddress(255, 255, 0, 0));

            Assert.AreEqual(true, netRoute.IsMatch(netIpAddressInsideBeforeOutside));
        }
Пример #7
0
        public void IsMatch_InsideAfterOutside( )
        {
            var netRoute = new SUTest(
                new NetIpAddress(124, 102, 0, 0),
                new NetIpAddress(255, 255, 0, 0),
                new NetIpAddress(172, 144, 11, 201));

            var netIpAddressInsideAfterOutside = new NetAddress(
                new NetIpAddress(124, 102, 0, 0),
                new NetIpAddress(255, 255, 0, 0));

            Assert.AreEqual(true, netRoute.IsMatch(netIpAddressInsideAfterOutside));
        }
Пример #8
0
        public void Constructor_CustomRoute_RandomValid( )
        {
            var netRoute = new SUTest(
                new NetIpAddress(124, 102, 0, 0),
                new NetIpAddress(255, 255, 0, 0),
                new NetIpAddress(172, 144, 11, 201));

            Assert.AreEqual(false, netRoute.IsDefault);
            CollectionAssert.AreEqual(new byte[] { 172, 144, 11, 201 }, netRoute.Target.Address.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.MaxAddress.Bytes, netRoute.Target.Netmask.Bytes);
            CollectionAssert.AreEqual(new byte[] { 172, 144, 11, 201 }, netRoute.Target.Broadcast.Bytes);
            CollectionAssert.AreEqual(new byte[] { 124, 102, 0, 0 }, netRoute.Address.Address.Bytes);
            CollectionAssert.AreEqual(new byte[] { 255, 255, 0, 0 }, netRoute.Address.Netmask.Bytes);
            CollectionAssert.AreEqual(new byte[] { 124, 102, 255, 255 }, netRoute.Address.Broadcast.Bytes);
        }
Пример #9
0
        public void Constructor_CustomRoute_Default( )
        {
            var netRoute = new SUTest(
                NetIpAddress.Zero,
                NetIpAddress.Zero,
                new NetIpAddress(172, 144, 11, 201));

            Assert.AreEqual(true, netRoute.IsDefault);
            CollectionAssert.AreEqual(new byte[] { 172, 144, 11, 201 }, netRoute.Target.Address.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.MaxAddress.Bytes, netRoute.Target.Netmask.Bytes);
            CollectionAssert.AreEqual(new byte[] { 172, 144, 11, 201 }, netRoute.Target.Broadcast.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.Zero.Bytes, netRoute.Address.Address.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.Zero.Bytes, netRoute.Address.Netmask.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.MaxAddress.Bytes, netRoute.Address.Broadcast.Bytes);
        }
Пример #10
0
        public void Constructor_CustomRoute_RandomValid( )
        {
            var netRoute = new SUTest(
                new NetIpAddress(124, 102, 0, 0),
                new NetIpAddress(255, 255, 0, 0),
                new NetIpAddress(172, 144, 11, 201));

            Assert.AreEqual(false, netRoute.IsDefault);
            CollectionAssert.AreEqual(new byte[] { 172, 144, 11, 201 }, netRoute.Target.Address.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.MaxAddress.Bytes, netRoute.Target.Netmask.Bytes);
            CollectionAssert.AreEqual(new byte[] { 172, 144, 11, 201 }, netRoute.Target.Broadcast.Bytes);
            CollectionAssert.AreEqual(new byte[] { 124, 102, 0, 0 }, netRoute.Address.Address.Bytes);
            CollectionAssert.AreEqual(new byte[] { 255, 255, 0, 0 }, netRoute.Address.Netmask.Bytes);
            CollectionAssert.AreEqual(new byte[] { 124, 102, 255, 255 }, netRoute.Address.Broadcast.Bytes);
        }
Пример #11
0
        public void Constructor_CustomRoute_Default( )
        {
            var netRoute = new SUTest(
                NetIpAddress.Zero,
                NetIpAddress.Zero,
                new NetIpAddress(172, 144, 11, 201));

            Assert.AreEqual(true, netRoute.IsDefault);
            CollectionAssert.AreEqual(new byte[] { 172, 144, 11, 201 }, netRoute.Target.Address.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.MaxAddress.Bytes, netRoute.Target.Netmask.Bytes);
            CollectionAssert.AreEqual(new byte[] { 172, 144, 11, 201 }, netRoute.Target.Broadcast.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.Zero.Bytes, netRoute.Address.Address.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.Zero.Bytes, netRoute.Address.Netmask.Bytes);
            CollectionAssert.AreEqual(NetIpAddress.MaxAddress.Bytes, netRoute.Address.Broadcast.Bytes);
        }
Пример #12
0
        public void IsValid_DefaultRoute( )
        {
            var netRoute = new SUTest(new NetIpAddress(124, 102, 11, 7));

            Assert.AreEqual(true, netRoute.IsValid( ));
        }
Пример #13
0
        public void IsValid_DefaultRoute( )
        {
            var netRoute = new SUTest(new NetIpAddress(124, 102, 11, 7));

            Assert.AreEqual(true, netRoute.IsValid( ));
        }
Пример #14
0
        public void IsValid_CustomRoute_RandomValid( )
        {
            var netRoute = new SUTest(
                new NetIpAddress(124, 102, 0, 0),
                new NetIpAddress(255, 255, 0, 0),
                new NetIpAddress(172, 144, 11, 201));

            Assert.AreEqual(true, netRoute.IsValid( ));
        }
Пример #15
0
        public void IsValid_CustomRoute_Default( )
        {
            var netRoute = new SUTest(
                NetIpAddress.Zero,
                NetIpAddress.Zero,
                new NetIpAddress(172, 144, 11, 201));

            Assert.AreEqual(true, netRoute.IsValid( ));
        }
Пример #16
0
        public void IsMatch_OutsideBefore( )
        {
            var netRoute = new SUTest(
                new NetIpAddress(124, 102, 0, 0),
                new NetIpAddress(255, 255, 0, 0),
                new NetIpAddress(172, 144, 11, 201));

            var netIpAddressOutsideBefore = new NetAddress(
                new NetIpAddress(124, 101, 255, 254),
                new NetIpAddress(255, 255, 0, 0));

            Assert.AreEqual(false, netRoute.IsMatch(netIpAddressOutsideBefore));
        }