Example #1
0
        public void Should_validate_only_when_input_has_been_specified()
        {
            var value = "entered input";

            var validationRule = new RequiredValidationRule();
            var result         = validationRule.Validate(value, null);

            Assert.IsTrue(result.IsValid);
        }
Example #2
0
        public void Should_not_validate_when_input_is_null()
        {
            String value          = null;
            var    validationRule = new RequiredValidationRule();
            var    result         = validationRule.Validate(value, null);

            Assert.IsFalse(result.IsValid);
            Assert.IsNotNull(result.ErrorContent);
        }
Example #3
0
        public void Validate_WithNonNullEmptyValue(string value)
        {
            // Arrange
            var sut = new RequiredValidationRule(ERROR_MESSAGE, false);

            // Act
            var result = sut.Validate(value);

            // Assert
            result.Should().BeTrue();
        }