예제 #1
0
        public void RequiredNotThereTestWithVistor()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);

            Assert.IsNotNull(requiredNode.Site);
            cmd.Execute(requiredNode);
            Assert.AreEqual(2, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
        public void MinLengthViolationTestWithValidateCommand()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);

            cmd.Execute(minLengthNode);

            Assert.AreEqual(2, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
        public void MinLengthTestWithValidateCommand()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);

            minLengthNode.Value1 = "MyTest";
            minLengthNode.Value2 = "MyTestPassword";
            cmd.Execute(minLengthNode);

            Assert.AreEqual(0, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
        public void RegexTestWithValidateCommand()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);

            Assert.IsNotNull(regexNode.Site);
            regexNode.Email = "*****@*****.**";
            cmd.Execute(regexNode);

            Assert.AreEqual(0, ValidationAttributeHelper.GetConfigurationErrorsCount(serviceProvider));
        }
        public void RegexViolationTestWithValidateCommand()
        {
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);

            Assert.IsNotNull(regexNode.Site);
            regexNode.Email = "joeblow.com";
            cmd.Execute(regexNode);

            Assert.AreEqual(1, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
        public void MaxLengthTestWithCommand()
        {
            maxLengthNode.Value1 = "aaa";
            maxLengthNode.Value2 = "aaaaaa";
            ValidateNodeCommand cmd = new ValidateNodeCommand(serviceProvider);

            cmd.Execute(maxLengthNode);

            Assert.AreEqual(0, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }
예제 #7
0
        public void RequiredValueTest()
        {
            RequiredAttribute attribute = new RequiredAttribute();

            requiredNode.Value2 = "MyTest";
            List <ValidationError> errors = new List <ValidationError>();

            attribute.Validate(requiredNode, valueInfo2, errors, ServiceProvider);
            Assert.AreEqual(0, ValidationAttributeHelper.GetValidationErrorsCount(serviceProvider));
        }