public void GetGoalsTestAwayAndHome() { Match target = new Match(new Club("Bordeaux"), new Club("Marseille")); target.AwayGoals = 2; target.HomeGoals = 1; Assert.AreEqual(2, target.GetGoals(false)); Assert.AreEqual(1, target.GetGoals(true)); }
public PointTotal(Match m, bool home) { this.goalaverage = m.GetGoals(home) - m.GetGoals(!home); int result = m.GetGoals(home) - m.GetGoals(!home); if (result > 0) { this.points += 1; } else { this.points += 0; } }
public void CompareToTest2() { Match m1 = new Match(new Club("Bordeaux"), new Club("Marseille")); m1.AwayGoals = 1; m1.HomeGoals = 3; FrenchLeague1PointSystem frenchRules = FrenchLeague1PointSystem.Instance; PointSystem.ITotal pointTotal1 = frenchRules.GetPointsFromMatch(m1, true); Match m2 = new Match(new Club("Paris"), new Club("Lens")); m2.AwayGoals = 2; m2.HomeGoals = 4; PointSystem.ITotal pointTotal2 = frenchRules.GetPointsFromMatch(m2, true); Assert.AreEqual(0, pointTotal1.CompareTo(pointTotal2)); //Egalité de points et égalité de goalaverage, la différence est donc de 0. }
public void CompareToTest1() { Match m1 = new Match(new Club("Bordeaux"), new Club("Marseille")); m1.AwayGoals = 1; m1.HomeGoals = 3; FrenchLeague1PointSystem frenchRules = FrenchLeague1PointSystem.Instance; PointSystem.ITotal pointTotal1 = frenchRules.GetPointsFromMatch(m1, true); Match m2 = new Match(new Club("Paris"), new Club("Lens")); m2.AwayGoals = 2; m2.HomeGoals = 1; PointSystem.ITotal pointTotal2 = frenchRules.GetPointsFromMatch(m2, true); Assert.AreEqual(1, pointTotal1.CompareTo(pointTotal2)); //Home de M1 gagne (+1 points) Home de M2 perd (+0 points), donc la différence est égale ) 1. }
public abstract ITotal GetPointsFromMatch(Match m, bool IsHome);
public void GetGoalsTestAway() { Match target = new Match(new Club("Bordeaux"), new Club("Marseille")); target.AwayGoals = 2; Assert.AreEqual(2, target.GetGoals(false)); }
public void AwayTest() { Match target = new Match(new Club ("Bordeaux"), new Club ("Marseille")); Assert.AreEqual("Marseille", target.Away.ToString()); }
public void AwayGoalsTest() { Match target = new Match(new Club("Bordeaux"), new Club("Marseille")); target.AwayGoals = 3; Assert.AreEqual(3, target.AwayGoals); }
public void IsHomeForfeitTest() { Match target = new Match(new Club("Bordeaux"), new Club("Marseille")); target.IsHomeForfeit = true; Assert.IsTrue(target.IsHomeForfeit); }
public void IsDrawTest() { Match target = new Match(new Club("Bordeaux"), new Club("Marseille")); target.HomeGoals = 2; target.AwayGoals = 2; Assert.IsTrue(target.IsDraw); }
public override ITotal GetPointsFromMatch(Match m, bool IsHome) { return new PointTotal(m, IsHome); }
public void IncrementTest() { FrenchLeague1PointSystem frenchRules = FrenchLeague1PointSystem.Instance; Match m1 = new Match(new Club("Bordeaux"), new Club("Marseille")); m1.AwayGoals = 1; m1.HomeGoals = 3; PointSystem.ITotal pointTotal1 = frenchRules.GetPointsFromMatch(m1, true); //1 Match m2 = new Match(new Club("Paris"), new Club("Lens")); m2.AwayGoals = 2; m2.HomeGoals = 3; PointSystem.ITotal pointTotal2 = frenchRules.GetPointsFromMatch(m2, true); //1 pointTotal1.Increment(pointTotal2); //2 Match m3 = new Match(new Club("test"), new Club("test1")); m2.AwayGoals = 2; m2.HomeGoals = 2; PointSystem.ITotal pointTotal3 = frenchRules.GetPointsFromMatch(m3, true); //0 ==> Crée pour comparer avec 0.*/ Assert.AreEqual(2, pointTotal1.CompareTo(pointTotal3)); //CompareTo = pointTotal1 - pointTotal3 = 2 - 0 = 2 }
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); }
public TotalMock(Match m, bool home) { this.points = m.GetGoals(home) - m.GetGoals(!home); }
public override PointSystem.ITotal GetPointsFromMatch(Match m, bool isHome) { return new TotalMock(m, isHome); }