public async Task Should_not_add_error_if_value_is_within_range(int?min, int?max) { var sut = new RangeValidator <int>(min, max); await sut.ValidateAsync(1500, errors); Assert.Equal(0, errors.Count); }
public async Task Should_not_add_error_if_value_is_null() { var sut = new RangeValidator <int>(100, 200); await sut.ValidateAsync(null, errors); Assert.Equal(0, errors.Count); }
public async Task Should_add_error_if_value_is_greater_than_max() { var sut = new RangeValidator <int>(null, 1000); await sut.ValidateAsync(1500, errors); errors.ShouldBeEquivalentTo( new[] { "<FIELD> must be less than '1000'." }); }
public async Task Should_add_error_if_value_is_smaller_than_min() { var sut = new RangeValidator <int>(2000, null); await sut.ValidateAsync(1500, errors); errors.ShouldBeEquivalentTo( new[] { "<FIELD> must be greater than '2000'." }); }