public void DataAttribute_Valid() { var obj = new UnitTestModel() { Name = "F#" }; var result = ValidationHandler.Validate(obj); Assert.IsNull(result); }
public void DataAttribute_Invalid() { var obj = new UnitTestModel() { Name = "<forbidden phrase>" }; var result = ValidationHandler.Validate(obj); Assert.IsNotNull(result); Assert.IsTrue(result.Any(x => x.ErrorMessage.Contains("<forbidden phrase>"))); Assert.IsTrue(result.Any(x => x.MemberNames.Any(n => n == "Name"))); }