public async Task Should_not_add_error_if_value_is_another_type() { var sut = new RequiredStringValidator(); await sut.ValidateAsync(true, errors); Assert.Empty(errors); }
public async Task Should_not_add_error_if_value_is_valid(string value) { var sut = new RequiredStringValidator(); await sut.ValidateAsync(value, errors); Assert.Equal(0, errors.Count); }
public async Task Should_add_error_if_value_is_null() { var sut = new RequiredStringValidator(); await sut.ValidateAsync(null, errors); 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); errors.ShouldBeEquivalentTo( new[] { "<FIELD> is required." }); }