Exemplo n.º 1
0
 def test_action_phase_plays_action_card_if_one_available(self):
     board = Board()
     player = Player(board)
     self.player.generate_hand()
     player.current_hand.append(KingdomCard('Village'))
     turn = Turn(player, board)
     phase = Phase('action', player)
     self.assertTrue(turn.take_phase(phase))
Exemplo n.º 2
0
class TurnTest(unittest.TestCase):

    def setUp(self):
        self.board = Board()
        self.player = Player(self.board)
        self.turn = Turn(self.player, self.board)

    def tearDown(self):
        pass

    def test_turn_starts_with_one_action(self):
        self.assertEqual(1, self.turn.actions)

    def test_turn_starts_with_one_buy(self):
        self.assertEqual(1, self.turn.buys)

    def test_turn_has_three_phases(self):
        self.assertEqual(3, len(self.turn.phases))

    def test_turn_first_phase_is_action(self):
        self.assertEqual('action', self.turn.phases[0].type)

    def test_turn_second_phase_is_buy(self):
        self.assertEqual('buy', self.turn.phases[1].type)

    def test_turn_third_phase_is_cleanup(self):
        self.assertEqual('cleanup', self.turn.phases[-1].type)

    def test_action_phase_plays_action_card_if_one_available(self):
        board = Board()
        player = Player(board)
        self.player.generate_hand()
        player.current_hand.append(KingdomCard('Village'))
        turn = Turn(player, board)
        phase = Phase('action', player)
        self.assertTrue(turn.take_phase(phase))

    def test_action_phase_passes_if_no_action_cards_available(self):
        phase = Phase('action', self.player)
        self.assertFalse(self.turn.take_phase(phase))

    def test_buy_phase_adds_card_to_player_discard(self):
        phase = Phase('buy', self.player)
        self.turn.take_phase(phase)
        self.assertEqual(1, len(self.player.discard))

    def test_buy_phase_removes_card_from_board(self):
        self.board.slots = [Slot(TreasureCard('Copper'))]
        phase = Phase('buy', self.player)
        self.turn.take_phase(phase)
        self.assertEqual(45, self.board.slots[0].num_cards)
Exemplo n.º 3
0
 def setUp(self):
     self.board = Board()
     self.player = Player(self.board)
     self.turn = Turn(self.player, self.board)