public void EvaluateShouldReturnSuccessForValidValue() { // arrange var rule = new RangeRule<int>( 10 ); var property = new Property<int>( "Counter", 5 ); var expected = ValidationResult.Success; // act var actual = rule.Evaluate( property ); // assert Assert.Equal( expected, actual ); }
public void EvaluateShouldReturnExpectedResultForInvalidValue( int value ) { // arrange var rule = new RangeRule<int>( 1, 10 ); var property = new Property<int>( "Counter", value ); // act var actual = rule.Evaluate( property ); // assert Assert.Equal( "The Counter field must be between 1 and 10.", actual.ErrorMessage ); Assert.Equal( 1, actual.MemberNames.Count() ); Assert.Equal( "Counter", actual.MemberNames.Single() ); }