public void DigitsOnlyExpressionWillSucceedWhenOnlyDigitsArePresent() { var instance = new DigitsOnlyExpressionTest { Text = "1234" }; var result = this.provider.Validate(instance); result.Should().NotBeNull("because we should always get a result"); result.IsApplicable.Should().BeTrue("because a regular expression attribute applies to a string property"); result.IsSuccess.Should().BeTrue("because the text contains only digits"); }
public void DigitsOnlyExpressionWillFailWhenNonDigitCharactersArePresent() { var instance = new DigitsOnlyExpressionTest { Text = "a" }; var result = this.provider.Validate(instance); result.Should().NotBeNull("because we should always get a result"); result.IsApplicable.Should().BeTrue("because a regular expression attribute applies to a string property"); result.IsSuccess.Should().BeFalse("because the text contains non-digit characters"); }