Ejemplo n.º 1
0
        public void CheckValidPropertiesExpectedNoErrors()
        {
            var customer = new ValidableCustomer {
                Name = NameProperty, Address = AddressProperty
            };

            validator.Validate(customer).Should().BeEmpty();
        }
Ejemplo n.º 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) });
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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)
            });
        }