Esempio n. 1
0
        public void ZipLengthFive()
        {
            var val    = new ZipValidValidator();
            var errors = val.Validate(new Person {
                Address = new Address {
                    ZIP = "12345"
                }
            });

            Assert.AreEqual(0, errors.Count);
        }
Esempio n. 2
0
        public void ZipCanStartWithZero()
        {
            var val    = new ZipValidValidator();
            var errors = val.Validate(new Person {
                Address = new Address {
                    ZIP = "00100"
                }
            });

            Assert.AreEqual(0, errors.Count);
        }
Esempio n. 3
0
        public void ZipWithOnlyDigits()
        {
            var val    = new ZipValidValidator();
            var errors = val.Validate(new Person {
                Address = new Address {
                    ZIP = "45892"
                }
            });

            Assert.AreEqual(0, errors.Count);
        }
Esempio n. 4
0
        public void ZipWithNotOnlyDigits()
        {
            var val    = new ZipValidValidator();
            var errors = val.Validate(new Person {
                Address = new Address {
                    ZIP = "pippo"
                }
            });

            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual("ZIP not valid!", errors[0]);
        }
Esempio n. 5
0
        public void ZipLengthMoreThanFive()
        {
            var val    = new ZipValidValidator();
            var errors = val.Validate(new Person {
                Address = new Address {
                    ZIP = "123456"
                }
            });

            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual("ZIP not valid!", errors[0]);
        }
Esempio n. 6
0
        public void ZipCannotBeBlack()
        {
            var val    = new ZipValidValidator();
            var errors = val.Validate(new Person {
                Address = new Address {
                    ZIP = "   "
                }
            });

            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual("ZIP not valid!", errors[0]);
        }