Hello,
I'm using Microsoft Enterprise Validation. But in this case the test passes, even if i assign null value to that attribute. Why?
[NotNullValidator(MessageTemplate = "Cannot be null!", Ruleset="validate_x")]
[StringLengthValidator(10, RangeBoundaryType.Inclusive, 40, RangeBoundaryType.Inclusive, Ruleset="validate_x")]
[RegexValidator(@"^[A-Z][a-z]*\s[A-Z][a-z]*$", MessageTemplate = "Not valid!", Ruleset="validate_x")]
public string x
{
get;
set;
}
And in a test class:
[TestMethod()]
public void xTest()
{
MyBO target = new MyBO() { x = null };
ValidationResults vr = Validation.Validate<MyBO>(target, "validate_x");
Assert.IsTrue(vr.IsValid);
}
So i got that this is valid, but it should not be. (x is null!) Any ideas?
Thanks