Beispiel #1
0
        public void Validate_WithErrorMessage_HasErrorMessage()
        {
            // Arrange
            var sut = new EqualValuesValidationRule <string>(ERROR_MESSAGE, "1");

            // Act
            var result = sut.Validate("2");

            // Assert
            sut.ErrorMessage.Should().Be(ERROR_MESSAGE);
        }
Beispiel #2
0
        public void Validate_WithIntegerAsValue(int value, int compareValue, bool validationResult)
        {
            // Arrange
            var sut = new EqualValuesValidationRule <int>(ERROR_MESSAGE, compareValue);

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

            // Assert
            result.Should().Be(validationResult);
        }
Beispiel #3
0
        public void Validate_WithSringAsValue(string value, string compareValue, bool validationResult)
        {
            // Arrange
            var sut = new EqualValuesValidationRule <string>(ERROR_MESSAGE, compareValue);

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

            // Assert
            result.Should().Be(validationResult);
        }
Beispiel #4
0
        public void Validate_WithSringFunctionAsValue(string value, string compareValue, bool validationResult)
        {
            // Arrange
            var valueToComapre = new Func <string>(() => compareValue);
            var sut            = new EqualValuesValidationRule <string>(ERROR_MESSAGE, valueToComapre);

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

            // Assert
            result.Should().Be(validationResult);
        }