public void TeamWithLargerNumberOfPointsShouldBeGreater() { //Arrane TeamResultsSummaryComparer comparer = new TeamResultsSummaryComparer(); TeamResultsSummary team1 = new TeamResultsSummary() { Points = 3 }; TeamResultsSummary team2 = new TeamResultsSummary() { Points = 0 }; //Act int comparisonResult = comparer.Compare(team1, team2); //Assert Assert.AreEqual(1, comparisonResult); }
public void SortTableAfterOneMatch() { //Arrange TeamResultsSummarySorter teamResultsSummarySorter = new TeamResultsSummarySorter(); TeamResultsSummary germanySummary = new TeamResultsSummary() { Team = "Germany", GoalsScored = 0, Points = 0, GoalsLost = 2, }; TeamResultsSummary polandSummary = new TeamResultsSummary() { Team = "Poland", GoalsScored = 2, Points = 3, GoalsLost = 0, }; List<TeamResultsSummary> teamsResults = new List<TeamResultsSummary>() { germanySummary, polandSummary }; //Act IEnumerable<TeamInTable> sortedTeamResults = teamResultsSummarySorter.Sort(teamsResults); //Assert List<TeamInTable> sortedTeamResultsList = sortedTeamResults.ToList(); Assert.That(sortedTeamResultsList[0].Position == 1); Assert.That(sortedTeamResultsList[1].Position == 2); Assert.That(sortedTeamResultsList[0].FootballTeamResultsSummary == polandSummary); Assert.That(sortedTeamResultsList[1].FootballTeamResultsSummary == germanySummary); }
public void HostsWin() { //Arrnage MatchRegulations matchRegulations = new MatchRegulations(); FootballMatch match = new FootballMatch() { HostTeam = "Poland", GuestTeam = "Germany", NumberOfGoalsScoredByHosts = 2, NumberOfGoalsScoredByGuests = 0 }; TeamResultsSummary hostTeam = new TeamResultsSummary() { Team = "Poland", GoalsLost = 0, GoalsScored = 0, Points = 0 }; TeamResultsSummary guestTeam = new TeamResultsSummary() { Team = "Germany", GoalsLost = 0, GoalsScored = 0, Points = 0 }; //Act matchRegulations.AddPointsAndGoals(match, hostTeam, guestTeam); Assert.That(hostTeam.Points == 3); Assert.That(hostTeam.GoalsScored == 2); Assert.That(hostTeam.GoalsLost == 0); Assert.That(guestTeam.Points == 0); Assert.That(guestTeam.GoalsScored == 0); Assert.That(guestTeam.GoalsLost == 2); }