public void SetResult(Score scoreA, Score scoreB) { var game = matches[currentMatch]; game.SetPlayed(true); game.SetTeamAScore(scoreA); game.SetTeamBScore(scoreB); LoadTeamsToList(); }
public void MatchStringTest() { var match = new MatchResult(); match.SetTeamAID(1); match.SetTeamBID(2); var scoreTeamA = new Score(); var scoreTeamB = new Score(); match.SetTeamAScore(scoreTeamA); match.SetTeamBScore(scoreTeamB); // Assert.AreEqual(match.ToString(), "1: tag: 0, flag: 0, score 0, 2: tag: 0, flag: 0, score 0"); }
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 LadderTierAllMatchesPlayed() { var lt = new LadderTier(); var totalTeams = 16; var teamIDs = GetTeamIDs(totalTeams); lt.GenerateRandomMatches(teamIDs); var matches = lt.GetAllMatches(); var scoreA = new Score(); scoreA.AddFlag(); var scoreB = new Score(); scoreB.AddTag(); foreach (var match in matches) { var key = match.Key; var value = match.Value; var teamAID = match.Value.GetTeamAID(); value.SetTeamAScore(scoreA); value.SetTeamBScore(scoreB); lt.SetMatch(key, value); Assert.AreEqual(teamAID, lt.GetWinner(key)); } Assert.IsTrue(lt.AllMatchesPlayed()); }
public void LadderTierUnplayedMatches() { var lt = new LadderTier(); var totalTeams = 16; var teamIDs = GetTeamIDs(totalTeams); lt.GenerateRandomMatches(teamIDs); var matches = lt.GetAllMatches(); var scoreA = new Score(); scoreA.AddFlag(); var scoreB = new Score(); scoreB.AddTag(); int i = 0; foreach (var match in matches) { if (i == 4) { break; } var key = match.Key; var value = match.Value; var teamAID = match.Value.GetTeamAID(); value.SetTeamAScore(scoreA); value.SetTeamBScore(scoreB); lt.SetMatch(key, value); Assert.AreEqual(teamAID, lt.GetWinner(key)); i++; } var played = lt.GetAllUnplayedMatches(); Assert.AreEqual(4, played.Count); }
private Score GetScores(int flag, int tag) { var score = new Score(); score.SetFlag(flag); score.SetTag(tag); return score; }
public void NewGame() { min = 0; sec = 0; teamAScore = new Score(); teamBScore = new Score(); }
public void SetTeamBScore(Score score) { teamBScore = score; }