Ejemplo n.º 1
0
        public void IPv4SubnetMask_IsIPAdressANetworkAddress(String subnetMaskInput, String addressInput, Boolean expectedResult)
        {
            IPv4SubnetMask mask    = IPv4SubnetMask.FromString(subnetMaskInput);
            IPv4Address    address = IPv4Address.FromString(addressInput);

            Boolean actual = mask.IsIPAdressANetworkAddress(address);

            Assert.Equal(expectedResult, actual);
        }
Ejemplo n.º 2
0
        public Boolean ArePropertiesAndValuesValid(IDictionary <String, String> valueMapper, ISerializer serializer)
        {
            try
            {
                if (valueMapper.ContainsKeys(new[] { nameof(NetworkAddress), nameof(Mask) }) == false)
                {
                    return(false);
                }

                var address = IPv4Address.FromString(serializer.Deserialze <String>(valueMapper[nameof(NetworkAddress)]));
                var mask    = new IPv4SubnetMask(new IPv4SubnetMaskIdentifier(Convert.ToInt32(serializer.Deserialze <String>(valueMapper[nameof(Mask)]))));

                return(mask.IsIPAdressANetworkAddress(address));
            }
            catch (Exception)
            {
                return(false);
            }
        }