public void RegexTest()
        {
            RegexAttribute attribute = new RegexAttribute(@"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
            regexNode.Email = "*****@*****.**";
			List<ValidationError> errors = new List<ValidationError>();
			attribute.Validate(regexNode, emailInfo, errors, ServiceProvider);
            Assert.AreEqual(0, errors.Count);
        }
Пример #2
0
 public void RegexViolationTest()
 {
     RegexAttribute attribute = new RegexAttribute(@"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
     regexNode.Email = "joeblow";
     ValidationErrorCollection errors = new ValidationErrorCollection();
     attribute.Validate(regexNode, emailInfo, errors);
     Assert.AreEqual(1, errors.Count);
 }
        public void RegexTest()
        {
            RegexAttribute attribute = new RegexAttribute(@"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");

            regexNode.Email = "*****@*****.**";
            List <ValidationError> errors = new List <ValidationError>();

            attribute.Validate(regexNode, emailInfo, errors, ServiceProvider);
            Assert.AreEqual(0, errors.Count);
        }
Пример #4
0
        public void RegexViolationTest()
        {
            RegexAttribute attribute = new RegexAttribute(@"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");

            regexNode.Email = "joeblow";
            ValidationErrorCollection errors = new ValidationErrorCollection();

            attribute.Validate(regexNode, emailInfo, errors);
            Assert.AreEqual(1, errors.Count);
        }