Esempio n. 1
0
 public Ranking(PointSystem system, Club[] clubs)
 {
     _system = system;
     _entries = new RankingEntry[clubs.Length];
     for (int i = 0; i < clubs.Length; i++)
         _entries[i] = new RankingEntry(clubs[i], system.InitialPoints);
 }
Esempio n. 2
0
 public RankingEntry EntryFromClub(Club c)
 {
     foreach (RankingEntry entry in _entries)
         if (entry.Club == c)
             return entry;
     return null;
 }
Esempio n. 3
0
 //private bool _isDraw;
 public Match(Club clubHome, Club clubAway, int goalsHome, int goalsAway)
 {
     _clubHome = clubHome;
     _clubAway = clubAway;
     _goalsHome = goalsHome;
     _goalsAway = goalsAway;
 }
Esempio n. 4
0
 public Match(Club clubHome, Club clubAway, bool isHomeForfeit)
 {
     _clubHome = clubHome;
     _clubAway = clubAway;
     _isHomeForfeit = isHomeForfeit;
     _isAwayForfeit = !isHomeForfeit;
 }
Esempio n. 5
0
 public void HomeGoalsTest()
 {
     Club c1 = new Club("club");
     Club c2 = new Club("club");
     Match m = new Match(c1, c2, 3, 5);
     Assert.AreEqual(3, m.HomeGoals);
 }
Esempio n. 6
0
 public void HomeTest()
 {
     Club c1 = new Club("club");
     Club c2 = new Club("club");
     Match m = new Match(c1,c2,3,5); // TODO: Initialize to an appropriate value
     Assert.AreEqual(c1, m.Home);
 }
Esempio n. 7
0
 public void AwayTest()
 {
     Club c1 = new Club("club");
     Club c2 = new Club("club");
     Match m = new Match(c1,c2,3,3); // TODO: Initialize to an appropriate value
     Assert.AreEqual(c2, m.Away);
 }
Esempio n. 8
0
 public void AwayGoalsTest()
 {
     Club c1 = new Club("club");
     Club c2 = new Club("club");
     Match m = new Match(c1, c2, 3, 5);
     Assert.AreEqual(5, m.AwayGoals);
 }
Esempio n. 9
0
        static void Main(string[] args)
        {
            Club c1 = new Club("Bordeaux");
            Club c2 = new Club("Marseille");
            Club c3 = new Club("Lyon");
            Club[] clubs = new Club[]{c1,c2,c3};

            Match m = new Match(c1, c2, 3, 1);
            Match m2 = new Match(c1, c3, 2, 2);
            Match m3 = new Match(c1, c3, 10, 1);

            FrenchLeague1PointSystem fr = FrenchLeague1PointSystem.Instance;

            Ranking rank = new Ranking(fr,clubs);
            rank.Register(m);
            rank.Register(m2);
            rank.Register(m3);

            Console.WriteLine(c1.ToString() + " - " + rank.EntryFromClub(c1).Points.ToString());
            Console.WriteLine(c2.ToString() + " - " + rank.EntryFromClub(c2).Points.ToString());
            Console.WriteLine(c3.ToString() + " - " + rank.EntryFromClub(c3).Points.ToString());

            Console.ReadLine();
        }
Esempio n. 10
0
 public RankingEntry(Club club, FootballLib.PointSystem.ITotal points)
 {
     this.club = club;
     this.points = points;
 }
Esempio n. 11
0
 public FootballLib.PointSystem.ITotal GetPoints(Club club)
 {
     return EntryFromClub(club).Points;
 }
Esempio n. 12
0
 public void isAwayForfeitTest()
 {
     Club c1 = new Club("club");
     Club c2 = new Club("club");
     Match m = new Match(c1,c2,true);
     Assert.AreEqual(false, m.isAwayForfeit);
 }
Esempio n. 13
0
 public void isHomeForfeitTest()
 {
     Club c1 = new Club("club");
     Club c2 = new Club("club2");
     Match m = new Match(c1, c2, true);
     Assert.AreEqual(true, m.isHomeForfeit);
 }
Esempio n. 14
0
 public void isDrawTest()
 {
     Club c1 = new Club("bordeaux");
     Club c2 = new Club("marseille");
     Match m = new Match(c1,c2,3,3); // TODO: Initialize to an appropriate value
     Assert.AreEqual(true, m.isDraw);
 }
Esempio n. 15
0
 public void ToStringTest()
 {
     Club target = new Club("Bordeaux"); // TODO: Initialize to an appropriate value
     string actual = target.ToString();
     Assert.AreEqual("Club: Bordeaux", actual);
 }