Beispiel #1
0
    def test_get_selected_cell_with_marked_cell_selection(self):
        expected_option = 2
        selected_options = [2, 1]
        game = Game(lambda n: selected_options.pop(), self.print_function)
        game.board.clean_marks()
        game.board.mark_cell(1, 1)
        option = game.get_selected_cell()
        self.assertEqual(option, expected_option)

        expected_printed_messages = 'Player 1s turn\n'
        expected_printed_messages += 'The cell is already marked, please select another one\n'
        expected_printed_messages += 'Player 1s turn\n'
        self.assertEqual(self.returned_string, expected_printed_messages)
Beispiel #2
0
 def test_get_selected_cell(self):
     expected_option = 1
     game = Game(lambda n: expected_option, self.print_function)
     game.board.clean_marks()
     option = game.get_selected_cell()
     self.assertEqual(option, expected_option)