public void CanUseAttributeAsValidationAttributeForValidValue() { ValidationAttribute attribute = new DomainValidatorAttribute(new object[] { "a", "b", "c" }) { MessageTemplate = "template {1}" }; Assert.IsTrue(attribute.IsValid("a")); }
public void ValidatingWithValidatorAttributeWithARulesetSkipsValidation() { ValidationAttribute attribute = new DomainValidatorAttribute(new object[] { "a", "b", "c" }) { MessageTemplate = "template {1}", Ruleset = "some ruleset" }; Assert.IsTrue(attribute.IsValid("z")); }
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")); }