public void CreateRound_InitializesRoundWithEmptyPairings()
 {
     var round = new Round();
     Assert.NotNull(round.Pairings);
     Assert.Empty(round.Pairings);
 }
예제 #2
0
 private static IEnumerable<Round> CreateEmptyRounds(int count)
 {
     var rounds = new Round[count];
     for (var i = 0; i < count; i++)
     {
         rounds[i] = new Round();
     }
     return rounds;
 }
        public void GetStandings_ReturnsPlayersWithScoresInDescOrder()
        {
            var tournament = new Tournament(new PairingGenerator(), 2) { Players = new[] { P1, P2, P3, P4 } };
            var pairings = tournament.RandomizePairings().ToList();
            pairings[0].SetScore(15, 5);
            pairings[1].SetScore(10, 10);

            PairingGenerator.Setup(
                pg => pg.Swiss(It.IsAny<IOrderedEnumerable<KeyValuePair<Player, int>>>(), It.IsAny<IList<Pairing>>()))
                .Returns(pairings);
            var standings = new Round { Pairings = pairings }.GetStandings().Select(i => i.Value).ToList();

            Assert.Equal(tournament.Players.Count(), standings.Count);
            Assert.Equal(standings, standings.OrderByDescending(i => i));
        }