Пример #1
0
        public void NameGenre_LengthIsLessThanExpected()
        {
            var book = new Book()
            {
                name  = "Co",
                genre = "Si",
            };

            var result = TestModelHelper.Validate(book);

            Assert.AreEqual(3, result.Count);
        }
Пример #2
0
        public void Year_NotFuture()
        {
            var book = new Book()
            {
                name  = "Swietna",
                genre = "Futurystyczna",
                year  = 2019
            };

            var result = TestModelHelper.Validate(book);

            Assert.AreEqual(1, result.Count);
        }
Пример #3
0
        public void Year_TooFew()
        {
            var book = new Book()
            {
                name  = "Elo",
                genre = "Ziomeczki",
                year  = 1899
            };

            var result = TestModelHelper.Validate(book);

            Assert.AreEqual(1, result.Count);
        }
Пример #4
0
        public void NameGenre_notWithCapitalLetter()
        {
            var book = new Book()
            {
                name  = "costam",
                genre = "jeszczejak",
                year  = 1900
            };

            var result = TestModelHelper.Validate(book);

            Assert.AreEqual(2, result.Count);
        }
Пример #5
0
        public void Year_CannotPutString()
        {
            var book = new Book()
            {
                name  = new string('Z', 41),
                genre = new string('X', 41),
                year  = _year
            };

            var result = TestModelHelper.Validate(book);

            Assert.AreEqual(2, result.Count);
        }
Пример #6
0
        public void NameStreetCity_NotCapitalChar()
        {
            var publisher = new Publisher()
            {
                name         = "insignis",
                street       = "złomowa",
                streetNumber = _streetNumber,
                postalCode   = _postalCode,
                city         = "sosnowiec",
                phone        = _phone
            };

            var result = TestModelHelper.Validate(publisher);

            Assert.AreEqual(3, result.Count);
        }
Пример #7
0
        public void NameStreetCity_TooLong()
        {
            var publisher = new Publisher()
            {
                name         = new string('X', 31),
                street       = new string('D', 41),
                streetNumber = _streetNumber,
                postalCode   = _postalCode,
                city         = new string('D', 31),
                phone        = _phone
            };

            var result = TestModelHelper.Validate(publisher);

            Assert.AreEqual(3, result.Count);
        }
Пример #8
0
        public void NameStreetCity_TooShort()
        {
            var publisher = new Publisher()
            {
                name         = "O",
                street       = "XDD",
                streetNumber = _streetNumber,
                postalCode   = _postalCode,
                city         = "W",
                phone        = _phone
            };

            var result = TestModelHelper.Validate(publisher);

            Assert.AreEqual(3, result.Count);
        }
Пример #9
0
        public void Phone_Wrong()
        {
            var publisher = new Publisher()
            {
                name         = _name,
                street       = _street,
                streetNumber = _streetNumber,
                postalCode   = _postalCode,
                city         = _city,
                phone        = "12345656352"
            };

            var result = TestModelHelper.Validate(publisher);

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