コード例 #1
0
        public static void Main(string[] args)
        {
            SoccerTeamsManager repo = new SoccerTeamsManager();


            repo.AddTeam(1, "Corinthians", DateTime.Now, "Branco", "Preto");
            repo.AddTeam(2, "São Paulo", DateTime.Now, "Branco", "Vermelho");

            repo.AddPlayer(1, 1, "Jogador 1", DateTime.Now, 89, 4001);
            repo.AddPlayer(2, 1, "Jogador 2", DateTime.Now, 34, 4002);
            repo.AddPlayer(3, 1, "Jogador 3", DateTime.Now, 98, 4500);
            repo.AddPlayer(4, 1, "Jogador 4", DateTime.Now, 56, 4003);
            repo.AddPlayer(5, 1, "Jogador 5", DateTime.Now, 54, 4004);
            repo.AddPlayer(6, 1, "Jogador 6", new DateTime(1989, 10, 27), 65, 4005);
            repo.AddPlayer(7, 1, "Jogador 7", DateTime.Now, 71, 4006);
            repo.AddPlayer(8, 1, "Jogador 8", DateTime.Now, 73, 4007);
            repo.AddPlayer(9, 1, "Jogador 9", DateTime.Now, 77, 4500);
            repo.AddPlayer(10, 1, "Jogador 10", DateTime.Now, 20, 4008);
            repo.AddPlayer(11, 1, "Jogador 11", DateTime.Now, 10, 4009);

            repo.AddPlayer(12, 2, "Jogador 1", DateTime.Now, 89, 3001);
            repo.AddPlayer(13, 2, "Jogador 2", DateTime.Now, 34, 3002);
            repo.AddPlayer(14, 2, "Jogador 3", DateTime.Now, 98, 3500);
            repo.AddPlayer(15, 2, "Jogador 4", new DateTime(1985, 10, 14), 56, 3003);
            repo.AddPlayer(16, 2, "Jogador 5", DateTime.Now, 54, 3004);
            repo.AddPlayer(17, 2, "Jogador 6", DateTime.Now, 100, 3005);
            repo.AddPlayer(18, 2, "Jogador 7", DateTime.Now, 71, 3006);
            repo.AddPlayer(19, 2, "Jogador 8", DateTime.Now, 73, 3007);
            repo.AddPlayer(20, 2, "Jogador 9", DateTime.Now, 77, 3500);
            repo.AddPlayer(21, 2, "Jogador 10", DateTime.Now, 20, 3008);
            repo.AddPlayer(22, 2, "Jogador 11", DateTime.Now, 10, 3009);

            repo.SetCaptain(8);
            repo.SetCaptain(18);

            var result1 = repo.GetTeamCaptain(1);
            var result2 = repo.GetTeamCaptain(2);

            var teams = repo.GetBestTeamPlayer(1);

            var p1 = repo.GetTeamPlayers(1);
            var p2 = repo.GetTeamPlayers(2);

            var color      = repo.GetVisitorShirtColor(1, 2);
            var salary     = repo.GetPlayerSalary(3);
            var MaxSalary1 = repo.GetHigherSalaryPlayer(1);
            var MaxSalary2 = repo.GetHigherSalaryPlayer(2);

            var best1 = repo.GetBestTeamPlayer(1);
            var best2 = repo.GetBestTeamPlayer(2);

            var best1n = repo.GetTopPlayers(10);

            var old1 = repo.GetOlderTeamPlayer(1);
            var old2 = repo.GetOlderTeamPlayer(2);
        }
コード例 #2
0
        public static 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);
            long captainId = manager.GetTeamCaptain(1); //1

            manager.SetCaptain(2);                      //PlayerNotFoundException
        }
コード例 #3
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));
        }
コード例 #4
0
        static void Main(string[] args)
        {
            SoccerTeamsManager Stm = new SoccerTeamsManager();

            Stm.AddTeam(1, "galo", new DateTime(2020, 05, 01), "preto e branco", "branco");
            Stm.AddPlayer(2, 1, "Tardelli", new DateTime(2000, 5, 2), 90, 10000m);
            Stm.AddPlayer(0, 1, "Victor", new DateTime(1990, 5, 2), 80, 100m);
            Stm.AddPlayer(1, 1, "Ronaldo", new DateTime(1984, 5, 2), 100, 1000m);
            Stm.SetCaptain(2);
            Console.WriteLine("O capitão é:{0}", Tabelas.Jogadores.Where(x => x.teamId == 1 && x.Capitao).Select(x => x.name).Single());
            Stm.SetCaptain(1);
            Console.WriteLine("O capitão é:{0}", Tabelas.Jogadores.Where(x => x.teamId == 1 && x.Capitao).Select(x => x.name).Single());
            Console.WriteLine(Stm.GetTeamCaptain(1));
            Console.WriteLine(Stm.GetPlayerName(0));
            Console.WriteLine(Stm.GetTeamName(1));
            var jog = Stm.GetTeamPlayers(1);

            jog.ForEach(x => Console.WriteLine(x));
            Console.WriteLine(Stm.GetBestTeamPlayer(1));
            Console.WriteLine(Stm.GetOlderTeamPlayer(1));
            Console.WriteLine(Stm.GetTeams());
            Console.WriteLine(Stm.GetHigherSalaryPlayer(1));
        }
コード例 #5
0
        static void Main(string[] args)
        {
            SoccerTeamsManager TeamManager = new SoccerTeamsManager();

            TeamManager.AddTeam(1, "Flamengo", DateTime.Now, "Vermelho", "Preto");
            TeamManager.AddTeam(2, "Inter", DateTime.Now, "Vermelho", "Branco");
            TeamManager.AddTeam(3, "Vasco", DateTime.Now, "Branco", "Preto");
            //TeamManager.AddTeam(4, "Gremio", DateTime.Now, "Azul", "Branco");
            //TeamManager.AddTeam(5, "Palmeiras", DateTime.Now, "Verde", "Branco");
            //TeamManager.AddTeam(6, "Atletico Parananense", DateTime.Now, "Preto", "Vermelho");


            TeamManager.AddPlayer(7, 1, "Edmundo", DateTime.Now, 19, 1000);
            TeamManager.AddPlayer(10, 1, "Romario", DateTime.Now, 9, 1000);

            TeamManager.AddPlayer(3, 2, "Dida", DateTime.Now, 11, 10000);
            TeamManager.AddPlayer(4, 2, "Dunga", DateTime.Now, 3, 8000);

            TeamManager.AddPlayer(5, 3, "Tafarel", DateTime.Now, 19, 20000);
            TeamManager.AddPlayer(6, 3, "Felipao", DateTime.Now, 4, 100000);

            TeamManager.SetCaptain(3);
            TeamManager.SetCaptain(2);
        }