public void IsValid_WithCustomValueFalse() { var target = new TestDataWithCustomValue() { Kind = 1, RequiredProperty = "set" }; var context = new ValidationContext(target, null, null); var results = new List <ValidationResult>(); var actual = Validator.TryValidateObject(target, context, results); //Assert actual.Should().BeTrue(); }
public void IsValid_WithCustomValueTrueAndPropertyNotSet() { var target = new TestDataWithCustomValue() { Kind = 2 }; var context = new ValidationContext(target, null, null); var results = new List <ValidationResult>(); var actual = Validator.TryValidateObject(target, context, results); //Assert actual.Should().BeFalse(); results.Should().HaveCount(1); }