Exemple #1
0
 private void TestRounds(IGame game)
 {
     // Quickly push the game to its end:
     for(int i = 1; i <= game.MaxNbRound; i++) {
         Assert.AreEqual(i, game.CurrentRound);
         game.EndRound();
         Assert.IsTrue(game.Player2.Equals(game.CurrentPlayer));
         game.EndRound();
         Assert.IsTrue(game.Player1.Equals(game.CurrentPlayer));
     }
     Assert.IsTrue(game.IsEndOfGame());
 }
Exemple #2
0
        /// <summary>
        /// Ends the game quickly and checks the winner by adding
        /// a great number of points to each player one after the other.
        /// </summary>
        /// <param name="game">The game to test.</param>
        private void TestWinner(IGame game)
        {
            game.Player1.AddPoints(1000);
            while(!game.IsEndOfGame()) {
                game.EndRound();
                game.EndRound();
            }
            Assert.IsTrue(game.GetWinner().Equals(game.Player1));

            game.Player2.AddPoints(10000);
            Assert.IsTrue(game.GetWinner().Equals(game.Player2));
        }