public void AtLeastNCharacterValidationRulePassesWithLongString() { var validationRule = new AtLeastNCharacterValidationRule() { MinimumStringLength = 5 }; ValidationResult result = validationRule.Validate("1234567891011121314151617181920", CultureInfo.CurrentCulture); Assert.IsTrue(result.IsValid); }
public void AtLeastNCharacterValidationRulePassesWithLongEnoughString() { var validationRule = new AtLeastNCharacterValidationRule() { MinimumStringLength = 4 }; ValidationResult result = validationRule.Validate("1234", CultureInfo.CurrentCulture); Assert.IsTrue(result.IsValid); }
public void AtLeastNCharacterValidationRuleFailsWithEmptyStringWhenZeroCharsIsInvalid() { var validationRule = new AtLeastNCharacterValidationRule() { MinimumStringLength = 4 }; ValidationResult result = validationRule.Validate(string.Empty, CultureInfo.CurrentCulture); Assert.IsFalse(result.IsValid); }
public void AtLeastNCharacterValidationRuleFailsWithShortString() { var validationRule = new AtLeastNCharacterValidationRule() { MinimumStringLength = 4 }; ValidationResult result = validationRule.Validate("123", CultureInfo.CurrentCulture); Assert.IsFalse(result.IsValid); }
public void AtLeastNCharacterValidationRulePassesWithNullValueWhenZeroCharsIsValid() { var validationRule = new AtLeastNCharacterValidationRule() { MinimumStringLength = 4, ZeroCharactersIsValid = true }; ValidationResult result = validationRule.Validate(null, CultureInfo.CurrentCulture); Assert.IsTrue(result.IsValid); }