Exemplo n.º 1
0
        public void Name_LengthIsGreaterThan50_NotValid()
        {
            var team = new Team()
            {
                Name = new string('C', 51)
            };

            var result = TestModelHelper.Validate(team);

            Assert.AreEqual(1, result.Count);
        }
Exemplo n.º 2
0
        public void Name_LengthIsLessThan3_NotValid()
        {
            var team = new Team()
            {
                Name = "aa",
            };

            var result = TestModelHelper.Validate(team);

            Assert.AreEqual(1, result.Count);
            //lub Assert.AreEqual("message", result[0].ErrorMessage);
        }
Exemplo n.º 3
0
        public void AllTeamData_IsValid()
        {
            var team = new Team()
            {
                Name           = _name,
                DateOfFounding = _dateOfFounding
            };

            var result = TestModelHelper.Validate(team);

            Assert.AreEqual(0, result.Count);
        }
Exemplo n.º 4
0
        public void NameNicknameSurname_LengthIsGreaterThan50_NotValid()
        {
            var player = new Player()
            {
                Name     = new string('A', 51),
                Surname  = new string('B', 51),
                Nickname = new string('C', 51)
            };

            var result = TestModelHelper.Validate(player);

            Assert.AreEqual(3, result.Count);
        }
Exemplo n.º 5
0
        public void NameNicknameSurname_LengthIsLessThan3_NotValid()
        {
            var player = new Player()
            {
                Name     = "AA",
                Surname  = "BB",
                Nickname = "CC",
            };

            var result = TestModelHelper.Validate(player);

            Assert.AreEqual(3, result.Count);
        }
Exemplo n.º 6
0
        public void NameSurname_IncorrectStringRegex_NotValid()
        {
            var player = new Player()
            {
                Name     = "Glup0t7j@k",
                Surname  = "Bzduryafa3q2ads1",
                Nickname = "Whatever;)"
            };

            var result = TestModelHelper.Validate(player);

            Assert.AreEqual(2, result.Count);
        }
Exemplo n.º 7
0
        public void Nickname_CannotBeEqualToName_NotValid()
        {
            var player = new Player()
            {
                Name     = _name,
                Surname  = _surname,
                Nickname = _name
            };

            var result = TestModelHelper.Validate(player);

            Assert.AreEqual(1, result.Count);
        }
Exemplo n.º 8
0
        public void Nickname_CannotContaint666Substring_NotValid()
        {
            var player = new Player()
            {
                Name     = _name + "666",
                Surname  = _surname,
                Nickname = _nickname
            };

            var result = TestModelHelper.Validate(player);

            Assert.AreEqual(1, result.Count);
        }
Exemplo n.º 9
0
        public void Salary_CannotBeLessThan0_NotValid()
        {
            var player = new Player()
            {
                Name     = _name,
                Surname  = _surname,
                Nickname = _nickname,
                Salary   = -10
            };

            var result = TestModelHelper.Validate(player);

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