Exemplo n.º 1
0
        public void CanUseAttributeAsValidationAttributeForValidValue()
        {
            ValidationAttribute attribute =
                new DomainValidatorAttribute(new object[] { "a", "b", "c" })
            {
                MessageTemplate = "template {1}"
            };

            Assert.IsTrue(attribute.IsValid("a"));
        }
Exemplo n.º 2
0
        public void ValidatingWithValidatorAttributeWithARulesetSkipsValidation()
        {
            ValidationAttribute attribute =
                new DomainValidatorAttribute(new object[] { "a", "b", "c" })
            {
                MessageTemplate = "template {1}",
                Ruleset         = "some ruleset"
            };

            Assert.IsTrue(attribute.IsValid("z"));
        }
Exemplo n.º 3
0
        public void CanUseAttributeAsValidationAttribute()
        {
            ValidationAttribute attribute =
                new DomainValidatorAttribute(new object[] { "a", "b", "c" })
            {
                MessageTemplate = "template {1}"
            };

            Assert.IsFalse(attribute.IsValid("z"));
            Assert.AreEqual("template name", attribute.FormatErrorMessage("name"));
        }