public void NullStringTestMethod()
 {
     IPAddressValidationRule _vr = new Controls.IPAddressValidationRule();
       Assert.IsNotNull(_vr);
       ValidationResult _res = _vr.Validate(null, System.Globalization.CultureInfo.InvariantCulture);
       Assert.IsFalse(_res.IsValid);
       Assert.IsNotNull(_res.ErrorContent);
       Assert.IsFalse(string.IsNullOrEmpty(_res.ErrorContent as string));
 }
        public void NotValidIPTestMethod()
        {
            IPAddressValidationRule _vr = new Controls.IPAddressValidationRule();

            Assert.IsNotNull(_vr);
            ValidationResult _res = _vr.Validate("139.255.255.999", System.Globalization.CultureInfo.InvariantCulture);

            Assert.IsFalse(_res.IsValid);
            Assert.IsNotNull(_res.ErrorContent);
            Assert.IsFalse(string.IsNullOrEmpty(_res.ErrorContent as string));
        }
        public void ValidStringTestMethod()
        {
            IPAddressValidationRule _vr = new Controls.IPAddressValidationRule();

            Assert.IsNotNull(_vr);
            ValidationResult _res = _vr.Validate("239.255.255.1", System.Globalization.CultureInfo.InvariantCulture);

            Assert.IsTrue(_res.IsValid);
            Assert.IsNull(_res.ErrorContent);
            _res = _vr.Validate("239.255.255.255", System.Globalization.CultureInfo.InvariantCulture);
            Assert.IsTrue(_res.IsValid);
            Assert.IsNull(_res.ErrorContent);
            _res = _vr.Validate("224.0.0.0", System.Globalization.CultureInfo.InvariantCulture);
            Assert.IsTrue(_res.IsValid);
            Assert.IsNull(_res.ErrorContent);
            _res = _vr.Validate("240.255.255.255", System.Globalization.CultureInfo.InvariantCulture);
            Assert.IsFalse(_res.IsValid);
            Assert.IsNotNull(_res.ErrorContent);
            _res = _vr.Validate("223.0.0.0", System.Globalization.CultureInfo.InvariantCulture);
            Assert.IsFalse(_res.IsValid);
            Assert.IsNotNull(_res.ErrorContent);
            _res = _vr.Validate("FF01:0:0:0:0:0:0:BAC0", System.Globalization.CultureInfo.InvariantCulture);
            Assert.IsFalse(_res.IsValid);
            Assert.IsNotNull(_res.ErrorContent);
            Assert.IsTrue(((string)_res.ErrorContent).Contains("The address family"));
        }
 public void ValidStringTestMethod()
 {
     IPAddressValidationRule _vr = new Controls.IPAddressValidationRule();
       Assert.IsNotNull(_vr);
       ValidationResult _res = _vr.Validate("239.255.255.1", System.Globalization.CultureInfo.InvariantCulture);
       Assert.IsTrue(_res.IsValid);
       Assert.IsNull(_res.ErrorContent);
       _res = _vr.Validate("239.255.255.255", System.Globalization.CultureInfo.InvariantCulture);
       Assert.IsTrue(_res.IsValid);
       Assert.IsNull(_res.ErrorContent);
       _res = _vr.Validate("224.0.0.0", System.Globalization.CultureInfo.InvariantCulture);
       Assert.IsTrue(_res.IsValid);
       Assert.IsNull(_res.ErrorContent);
       _res = _vr.Validate("240.255.255.255", System.Globalization.CultureInfo.InvariantCulture);
       Assert.IsFalse(_res.IsValid);
       Assert.IsNotNull(_res.ErrorContent);
       _res = _vr.Validate("223.0.0.0", System.Globalization.CultureInfo.InvariantCulture);
       Assert.IsFalse(_res.IsValid);
       Assert.IsNotNull(_res.ErrorContent);
       _res = _vr.Validate("FF01:0:0:0:0:0:0:BAC0", System.Globalization.CultureInfo.InvariantCulture);
       Assert.IsFalse(_res.IsValid);
       Assert.IsNotNull(_res.ErrorContent);
       Assert.IsTrue(((string)_res.ErrorContent).Contains("The address family"));
 }