예제 #1
0
        public void Constructor_SetErrorMessage()
        {
            // Arrange / Act
            var compareValue = new ValidatableValue <int>
            {
                Value = 100
            };
            var sut = new SmallerThanValidationRule <int>(ERROR_MESSAGE, compareValue);

            // Assert
            sut.ErrorMessage.Should().Be(ERROR_MESSAGE);
        }
예제 #2
0
        [TestCase(101, 100, 100)] // Edge case, equal
        public void Validate_WithHigher_IsNotValid(int initValue, int newValue, int current)
        {
            // Arrange
            var compareValue = new ValidatableValue <int>
            {
                Value = initValue
            };
            var sut = new SmallerThanValidationRule <int>(ERROR_MESSAGE, compareValue);

            sut.Validate(current).Should().BeTrue();

            // Act
            compareValue.Value = newValue;
            var result = sut.Validate(current);

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