Ejemplo n.º 1
0
        public void notOutOfPenaltyBoxAfterEvenRoll()
        {
            Game g = createGameWithTwoPlayers();

            g.Roll(2);
            g.MarkCurrentAnswerAsIncorrectAndMoveToNextPlayer();
            Assert.IsTrue(g.IsPreviousPlayerInPenaltyBox());
            g.Roll(3);
            g.MarkCurrentAnswerAsCorrectAndMoveToNextPlayer();
            g.Roll(2);
            g.MarkCurrentAnswerAsCorrectAndMoveToNextPlayer();
            Assert.IsTrue(g.IsPreviousPlayerInPenaltyBox());
        }
Ejemplo n.º 2
0
        public void notToPenaltyBoxAfterCorrectAnswer()
        {
            Game g = createGameWithTwoPlayers();

            g.Roll(2);
            g.MarkCurrentAnswerAsCorrectAndMoveToNextPlayer();
            Assert.IsFalse(g.IsPreviousPlayerInPenaltyBox());
        }
Ejemplo n.º 3
0
        public void getsCoinAfterCorrectAnswer()
        {
            Game g = createGameWithTwoPlayers();

            g.Roll(5);
            Assert.That(g.playerCoins [0], Is.EqualTo(0));
            g.MarkCurrentAnswerAsCorrectAndMoveToNextPlayer();
            Assert.That(g.playerCoins [0], Is.EqualTo(1));
        }
Ejemplo n.º 4
0
        public void advancesPlayerAfterAnswer()
        {
            Game g = createGameWithTwoPlayers();

            Assert.That(g.currentPlayerIndex, Is.EqualTo(0));
            g.Roll(5);
            g.MarkCurrentAnswerAsCorrectAndMoveToNextPlayer();
            Assert.That(g.currentPlayerIndex, Is.EqualTo(1));
            g.Roll(3);
            g.MarkCurrentAnswerAsIncorrectAndMoveToNextPlayer();
            Assert.That(g.currentPlayerIndex, Is.EqualTo(0));
        }
Ejemplo n.º 5
0
        public static void Main(String[] args)
        {
            Game aGame = new Game();

            aGame.Add("Chet");
            aGame.Add("Pat");
            aGame.Add("Sue");

            Random rand = new Random();

            do
            {
                aGame.Roll(rand.Next(5) + 1);

                if (rand.Next(9) == 7)
                {
                    notAWinner = aGame.MarkCurrentAnswerAsIncorrectAndMoveToNextPlayer();
                }
                else
                {
                    notAWinner = aGame.MarkCurrentAnswerAsCorrectAndMoveToNextPlayer();
                }
            } while (notAWinner);
        }
Ejemplo n.º 6
0
 private bool rollAndGiveCorrectAnswer(Game g)
 {
     g.Roll(4);
     return(g.MarkCurrentAnswerAsCorrectAndMoveToNextPlayer());
 }