Beispiel #1
0
        public void CheckValidPropertiesExpectedNoErrors()
        {
            var customer = new ValidableCustomer {
                Name = NameProperty, Address = AddressProperty
            };

            validator.Validate(customer).Should().BeEmpty();
        }
Beispiel #2
0
        public void CheckNotValidPropertyExpectedSingleError()
        {
            const string Name     = "B";
            var          customer = new ValidableCustomer {
                Name = Name
            };

            validator
            .Validate(customer, NameProperty)
            .Should().BeSameAs(new[] { new ValidationError(NameProperty, PropertyTooShort, Name) });
        }
Beispiel #3
0
        public void CheckNotValidPropertiesExpectedError()
        {
            var customer = new ValidableCustomer();

            var validationErrors = validator.Validate(customer);

            var expectedValidationErrors =
                new[]
            {
                new ValidationError(NameProperty, PropertyEmpty, null),
                new ValidationError(AddressProperty, PropertyEmpty, null)
            };

            validationErrors.Should().BeSameAs(expectedValidationErrors);
        }
Beispiel #4
0
        public void CheckNotValidPropertyExpectedError()
        {
            var customer = new ValidableCustomer {
                Name = string.Empty
            };

            validator
            .Validate(customer, NameProperty)
            .Should().BeSameAs(
                new[]
            {
                new ValidationError(NameProperty, PropertyEmpty, string.Empty),
                new ValidationError(NameProperty, PropertyTooShort, null)
            });
        }