コード例 #1
0
        public JailBoardTests()
        {
            board = new MockJailBoard();
            horse = new Player("Horse");

            always3Dice      = new Dice(6, new AlwaysGenerateThree());
            alwaysDubTwoDice = new Dice(6, new AlwaysGenerateDubTwo());
            neverDubDice     = new Dice(6, new NonDoublesGenerator());
        }
コード例 #2
0
        public void RollsDoubles_ThreeTimesButPassesGoBeforeThirdTurn_ShouldCollect200Dollars()
        {
            Board  board = new MockJailBoard();
            Dice   dice  = new Dice(6, new DoublesGenerator());
            Player horse = new Player("Horse");

            horse.Bank = 200;
            Turn turn = new Turn(board, dice);

            board.AddPlayerToBoard(horse, 37);
            turn.Take(horse);

            Assert.Equal(400, horse.Bank);
            Assert.True(horse.IsInJail);
            Assert.Equal(10, horse.Position);
        }
コード例 #3
0
        public void RollsDoubles_ThreeTimesInSingleTurn_ShouldGoToJail()
        {
            Board  board = new MockJailBoard();
            Dice   dice  = new Dice(6, new DoublesGenerator());
            Player horse = new Player("Horse");

            horse.Bank = 200;
            Turn turn = new Turn(board, dice);

            board.AddPlayerToBoard(horse, 0);
            turn.Take(horse);

            Assert.Equal(200, horse.Bank);
            Assert.True(horse.IsInJail);
            Assert.Equal(10, horse.Position);
        }