コード例 #1
0
 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());
 }
コード例 #2
0
 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);
 }