public void Validate_ForNullNotAllowed_Fails() { // Arrange string value = null; var sut = new StringLengthValidationRule(ERROR_MESSAGE, 20); // Act var result = sut.Validate(value); // Assert result.Should().BeFalse(); }
public void Validate_ForNullAllowed_Pass() { // Arrange string value = null; var sut = new StringLengthValidationRule(ERROR_MESSAGE, 20, nullIsValid: true); // Act var result = sut.Validate(value); // Assert result.Should().BeTrue(); }
public void Validate_ForMinLength(int length, int valueLength, bool expected) { // Arrange var value = GetValueOfLength(valueLength); var sut = new StringLengthValidationRule(ERROR_MESSAGE, length, checkMaxLength: false); // Act var result = sut.Validate(value); // Assert result.Should().Be(expected); }