Esempio n. 1
0
        public void  GetSoccerTeamFromSpecificIndex()
        {
            SoccerTeam ucluj = new SoccerTeam("UCLUJ", 19);

            SoccerTeam[] soccerTeams  = new SoccerTeam[1];
            TeamsRanking teamsRanking = new TeamsRanking(soccerTeams);

            soccerTeams[0] = ucluj;
            Assert.Equal(ucluj, teamsRanking.GetValueFromSpecificIndex(0));
        }
Esempio n. 2
0
        public void AddTeamsToRanking()
        {
            SoccerTeam ucluj = new SoccerTeam("UCLUJ", 19);
            SoccerTeam cfr   = new SoccerTeam("CFR", 10);

            SoccerTeam[] soccerTeams  = new SoccerTeam[0];
            TeamsRanking teamsRanking = new TeamsRanking(soccerTeams);

            teamsRanking.AddNewTeam(ucluj);
            teamsRanking.AddNewTeam(cfr);
            Assert.Equal(ucluj, teamsRanking.GetValueFromSpecificIndex(0));
        }
Esempio n. 3
0
        public void UpdateRankingForDrow()
        {
            SoccerTeam ucluj   = new SoccerTeam("UCLUJ", 12);
            SoccerTeam cfr     = new SoccerTeam("CFR", 10);
            SoccerTeam craiova = new SoccerTeam("Craiova", 10);

            SoccerTeam[] soccerTeams  = new SoccerTeam[0];
            TeamsRanking teamsRanking = new TeamsRanking(soccerTeams);

            teamsRanking.AddNewTeam(ucluj);
            teamsRanking.AddNewTeam(cfr);
            teamsRanking.AddNewTeam(craiova);
            teamsRanking.Play(cfr, 2, ucluj, 2);
            Assert.Equal(1, teamsRanking.GetPositionForSoccerTeam(cfr));
        }
Esempio n. 4
0
        public void GetSpecificIndexForSoccerTeam()
        {
            SoccerTeam ucluj   = new SoccerTeam("UCLUJ", 19);
            SoccerTeam cfr     = new SoccerTeam("CFR", 10);
            SoccerTeam craiova = new SoccerTeam("Craiova", 7);

            SoccerTeam[] soccerTeams  = new SoccerTeam[2];
            TeamsRanking teamsRanking = new TeamsRanking(soccerTeams);

            soccerTeams[0] = ucluj;
            soccerTeams[1] = cfr;
            Assert.Equal(1, teamsRanking.GetPositionForSoccerTeam(cfr));
            Assert.Equal(0, teamsRanking.GetPositionForSoccerTeam(ucluj));
            Assert.Equal(-1, teamsRanking.GetPositionForSoccerTeam(craiova));
        }
Esempio n. 5
0
        public void SortingRanking()
        {
            SoccerTeam ucluj   = new SoccerTeam("UCLUJ", 19);
            SoccerTeam cfr     = new SoccerTeam("CFR", 10);
            SoccerTeam craiova = new SoccerTeam("Craiova", 7);

            SoccerTeam[] soccerTeams  = new SoccerTeam[3];
            TeamsRanking teamsRanking = new TeamsRanking(soccerTeams);

            soccerTeams[0] = ucluj;
            soccerTeams[1] = craiova;
            soccerTeams[2] = cfr;
            teamsRanking.Sort();
            Assert.Equal(0, teamsRanking.GetPositionForSoccerTeam(ucluj));
            Assert.Equal(1, teamsRanking.GetPositionForSoccerTeam(cfr));
            Assert.Equal(2, teamsRanking.GetPositionForSoccerTeam(craiova));
        }
Esempio n. 6
0
        public void UpdateRankingForDrow()
        {
            SoccerTeam ucluj   = new SoccerTeam("UCLUJ", 12);
            SoccerTeam cfr     = new SoccerTeam("CFR", 10);
            SoccerTeam craiova = new SoccerTeam("Craiova", 9);

            SoccerTeam[] soccerTeams  = new SoccerTeam[0];
            TeamsRanking teamsRanking = new TeamsRanking(soccerTeams);

            teamsRanking.AddNewTeam(ucluj);
            teamsRanking.AddNewTeam(cfr);
            teamsRanking.AddNewTeam(craiova);
            Match match = new Match(ucluj, craiova, 1, 1);

            match.UpdateRanking();
            Assert.True(cfr.LessPointsThan(ucluj));
        }
Esempio n. 7
0
        public void  UpdateRankingForWin()
        {
            SoccerTeam ucluj   = new SoccerTeam("UCLUJ", 12);
            SoccerTeam cfr     = new SoccerTeam("CFR", 10);
            SoccerTeam craiova = new SoccerTeam("Craiova", 9);

            SoccerTeam[] soccerTeams  = new SoccerTeam[0];
            TeamsRanking teamsRanking = new TeamsRanking(soccerTeams);

            teamsRanking.AddNewTeam(ucluj);
            teamsRanking.AddNewTeam(cfr);
            teamsRanking.AddNewTeam(craiova);
            Match match = new Match(ucluj, cfr, 0, 1);

            match.UpdateRanking();
            teamsRanking.Sort();
            Assert.Equal(0, teamsRanking.GetPositionForSoccerTeam(cfr));
        }