public void MatchWinnerTests() { var match = new MatchResult(); match.SetTeamAID(1); match.SetTeamBID(2); var scoreTeamA = new Score(); var scoreTeamB = new Score(); for(int i = 0; i < 3; i++) { scoreTeamA.AddTag(); } scoreTeamA.AddFlag(); for(int i = 0; i < 10; i++) { scoreTeamB.AddTag(); } match.SetTeamAScore(scoreTeamA); match.SetTeamBScore(scoreTeamB); Assert.AreEqual(2, match.GetWinner()); }
public void MatchPlayed(int ID, MatchResult mr) { mr.SetPlayed(true); ladderTiers[currentTier].SetMatch(ID, mr); var winnerID = mr.GetWinner(); if (winnerID != -1) { if (currentTier + 1 != tierCount) { ladderTiers[currentTier + 1].AddTeam(winnerID, ID); if (ladderTiers[currentTier].AllMatchesPlayed()) { var breakTeams = ladderTiers[currentTier++].GetAllBreaks(); AddBreakTeams(breakTeams); } } else { this.tournamentWinnerID = winnerID; throw new TournamentWinnerException(winnerID); } } else { mr.SetPlayed(false); } }