Beispiel #1
0
        public void StreetNotEmpty()
        {
            var val    = new StreetNotEmptyValidator();
            var errors = val.Validate(new Person {
                Address = new Address {
                    Street = "new street"
                }
            });

            Assert.AreEqual(0, errors.Count);
        }
Beispiel #2
0
        public void StreetNull()
        {
            var val    = new StreetNotEmptyValidator();
            var errors = val.Validate(new Person {
                Address = new Address {
                    Street = null
                }
            });

            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual("Street not valid!", errors[0]);
        }
Beispiel #3
0
        public void ZIPValidValidatorErrorListNotEmpty()
        {
            var addNotNull  = new AddressNotNullValidator();
            var strNotEmpty = new StreetNotEmptyValidator();
            var zipVal      = new ZipValidValidator();

            var baseVal = new List <BaseValidator>()
            {
                addNotNull, strNotEmpty, zipVal,
            };

            var val    = new AddresValidator(baseVal);
            var errors = val.Validate(new Person
            {
                Address = new Address
                {
                    Street = "via Roma, 5",
                    ZIP    = "33j0"
                }
            });

            Assert.AreEqual(1, errors.Count);
        }