def test_given_a_valid_parameters_and_none_game_then_should_raise_an_exception(self): cmd = RestartGameCommand(None) try: cmd.execute() self.fail("Expected InvalidCmdParametersException was not raised.") except InvalidCmdParametersException: pass
def test_given_a_valid_parameters_and_none_initial_sudoku_then_should_raise_an_exception(self): game = Game() game.user_sudoku = SudokuBoard(3) cmd = RestartGameCommand(None) cmd.set_game(game) try: cmd.execute() self.fail("Expected InvalidCmdParametersException was not raised.") except InvalidCmdParametersException: pass
def test_when_restart_game_is_executed_then_the_user_table_should_be_restarted_properly(self): sudoku = SudokuBoard(3) user_sudoku = SudokuBoard(3) sudoku.from_dictionary(self.solved_sudoku, True) user_sudoku.from_dictionary(self.user_sudoku, True) game = Game() game.initial_sudoku = sudoku game.user_sudoku = user_sudoku cmd = RestartGameCommand(None) cmd.set_game(game) cmd.execute() self.assertDictEqual(game.initial_sudoku.to_dictionary(), game.user_sudoku.to_dictionary())