Beispiel #1
0
        public void Validate_WhenTypeIsNotStringOrHasValue_ReturnsSuccess(object obj)
        {
            //Given
            var validator = new NotEmpty();

            //When
            var config = new FieldConfigBuilder().Build();
            var result = validator.Validate(obj, 0, config);

            //Then
            result.IsValid.Should().BeTrue();
        }
Beispiel #2
0
        public void Validate_WhenIsNotEmpty_ReturnsSuccess(string value)
        {
            //Given
            var validator = new NotEmpty();

            //When
            var config = new FieldConfigBuilder().Build();
            var result = validator.Validate(value, 0, config);

            //Then
            result.IsValid.Should().BeTrue();
        }
Beispiel #3
0
        public void Validate_WhenIsEmptyOrWhiteSpaces_ReturnsError(string value)
        {
            ///Given
            var validator = new NotEmpty();

            //When
            var config = new FieldConfigBuilder().Build();
            var result = validator.Validate(value, 0, config);

            //Then
            result.IsValid.Should().BeFalse();
            result.Errors[0].Value.Should().Contain("should not be empty");
        }