Example #1
0
        public void Should_Be_Valid_Player_When_Set_Captain()
        {
            var manager = new SoccerTeamsManager();

            manager.AddTeam(1, "Time 1", DateTime.Now, "cor 1", "cor 2");
            manager.AddPlayer(1, 1, "Jogador 1", DateTime.Today, 0, 0);
            manager.SetCaptain(1);
            Assert.Equal(1, manager.GetTeamCaptain(1));
            Assert.Throws <PlayerNotFoundException>(() =>
                                                    manager.SetCaptain(2));
        }
Example #2
0
        public void Should_Be_Unique_Player_As_Team_Captain()
        {
            var manager = new SoccerTeamsManager();

            manager.AddTeam(1, "Time 1", DateTime.Now, "cor 1", "cor 2");
            manager.AddTeam(2, "Time 2", DateTime.Now, "cor 3", "cor 4");
            manager.AddPlayer(1, 1, "Jogador 1", DateTime.Today, 0, 0);
            manager.AddPlayer(2, 1, "Jogador 2", DateTime.Today, 0, 0);
            manager.AddPlayer(3, 2, "Jogador 3", DateTime.Today, 0, 0);
            manager.AddPlayer(4, 2, "Jogador 4", DateTime.Today, 0, 0);

            manager.SetCaptain(1);
            Assert.Equal(1, manager.GetTeamCaptain(1));

            manager.SetCaptain(2);
            Assert.Equal(2, manager.GetTeamCaptain(1));

            manager.SetCaptain(3);
            Assert.Equal(2, manager.GetTeamCaptain(1));
            Assert.Equal(3, manager.GetTeamCaptain(2));
        }