예제 #1
0
            public PointTotal(Match m, bool home)
            {
                if (home)
                {
                    _goalaverage += m.HomeGoals - m.AwayGoals;
                }
                else
                    _goalaverage += m.AwayGoals - m.HomeGoals;

                if (m.HomeGoals > m.AwayGoals)
                {
                    if (home)
                    {
                        _points += 3;
                    }
                    else
                    {
                        _points += 0;
                    }
                }
                else if (m.HomeGoals < m.AwayGoals)
                    if (home)
                    {
                        _points += 0;
                    }
                    else
                    {
                        _points += 3;
                    }
                else if(m.HomeGoals == m.AwayGoals){
                    _points +=1;
                }
            }
예제 #2
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);
 }
예제 #3
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);
 }
예제 #4
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);
 }
        public void PointTotalMatchNulHome()
        {
            FrenchLeague1PointSystem fr = FrenchLeague1PointSystem.Instance;
            Match m = new Match(new Club("Bordeaux"), new Club("Marseille"), 2, 2);
            bool home = true;

            Assert.AreEqual("Points : 1 Goal average : 0", fr.GetPointsFromMatch(m, home).ToString());
        }
        public void PointTotalDefaiteAway()
        {
            FrenchLeague1PointSystem fr = FrenchLeague1PointSystem.Instance;
            Match m = new Match(new Club("Bordeaux"), new Club("Marseille"), 2, 1);
            bool home = false;

            Assert.AreEqual("Points : 0 Goal average : -1", fr.GetPointsFromMatch(m, home).ToString());
        }
예제 #7
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();
        }
예제 #8
0
 public PointSystemMock(Match m, bool home)
 {
     this.points = m.HomeGoals - m.AwayGoals;
 }
예제 #9
0
 public void Register(Match m)
 {
     EntryFromClub(m.Home).Points.Increment(_system.GetPointsFromMatch(m, true));
     EntryFromClub(m.Away).Points.Increment(_system.GetPointsFromMatch(m, false));
     Array.Sort(_entries);
 }
예제 #10
0
 public virtual ITotal GetPointsFromMatch(Match m, bool isHome)
 {
     return new PointSystemMock(m, isHome);
 }
예제 #11
0
 public override ITotal GetPointsFromMatch(Match m,  bool isHome)
 {
     return new PointTotal(m, isHome);
 }
예제 #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);
 }
예제 #13
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);
 }
예제 #14
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);
 }
예제 #15
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);
 }