public async Task Should_not_add_error_if_optional() { var sut = new RequiredStringValidator(); await sut.ValidateAsync(string.Empty, true, errors.Add); Assert.Equal(0, errors.Count); }
public async Task Should_not_add_error_if_value_is_another_type() { var sut = new RequiredStringValidator(); await sut.ValidateAsync(true, errors.Add); Assert.Equal(0, errors.Count); }
public async Task Should_not_add_error_if_value_is_valid(string value) { var sut = new RequiredStringValidator(); await sut.ValidateAsync(value, false, errors.Add); Assert.Equal(0, errors.Count); }
public async Task Should_add_error_if_value_is_null() { var sut = new RequiredStringValidator(); await sut.ValidateAsync(null, errors.Add); errors.ShouldBeEquivalentTo( new[] { "<FIELD> is required" }); }
public async Task Should_add_error_if_empty_strings_are_not_allowed() { var sut = new RequiredStringValidator(true); await sut.ValidateAsync(string.Empty, errors.Add); errors.ShouldBeEquivalentTo( new[] { "<FIELD> is required" }); }