Esempio n. 1
0
        static void AddTeamMatch()
        {
            IPlayerManipulations playerLogic  = new PlayerLogic();
            IGameManipulations   gameLogic    = new GameLogic();
            ITeamManipulations   teamLogic    = new TeamLogic();
            IMatchManipulations  matchLogic   = new MatchLogic();
            IRankingSource       rankingLogic = new RankingLogic();

            List <PlayerType> players = playerLogic.GetPlayers();
            List <GameType>   games   = gameLogic.GetGames();

            // add team
            Console.WriteLine("-> adding teams...");
            Console.WriteLine("\t\t#Method AddOrUpdateTeam()");
            teamLogic.AddOrUpdateTeam(new TeamType("FirstTeam", new List <PlayerType> {
                players[0]
            }));
            teamLogic.AddOrUpdateTeam(new TeamType("SecondTeam", new List <PlayerType> {
                players[2]
            }));

            // print teams
            Console.WriteLine("\t\t#Method TeamType.ToString()");
            Console.WriteLine("------- Teams Game -------");
            foreach (TeamType t in teamLogic.GetTeams())
            {
                Console.WriteLine(t.ToString());
            }
            Console.WriteLine("------- @@@@@ -------\n\n");
            // wait for user
            Wait();

            // add match between 2 teams
            Console.WriteLine("-> adding team match...");
            Console.WriteLine("\t\t#Method GetTeams()");
            List <TeamType> teams = teamLogic.GetTeams();

            Console.WriteLine("\t\t#Method AddOrUpdateTeamMatch()");
            matchLogic.AddOrUpdateTeamMatch(new TeamMatch(MatchCategories.Competition, games[0], new List <TeamType> {
                teams[0], teams[1]
            }, new List <int> {
                200, 3000
            }));
            // print match
            Console.WriteLine("\t\t#Method GetMatchesForTeam()");
            Console.WriteLine("------- First Team Match -------");
            TeamMatch team = (TeamMatch)teamLogic.GetMatchesForTeam(teams[0])[0];

            Console.WriteLine(team.ToString());
            Console.WriteLine("------- @@@@@ -------\n\n");


            // print ranking
            Console.WriteLine("\t\t#Method GetGameRankingsAll()");
            Console.WriteLine("------- Ranking Game -------");
            foreach (PlayerGameRankingType g in rankingLogic.GetGameRankingsAll(games[0], ParticipantTypes.All))
            {
                Console.WriteLine(g.ToString());
            }
            Console.WriteLine("------- @@@@@ -------\n\n");
            // wait for user
            Wait();
        }