def test_given_a_valid_parameters_and_none_game_then_should_raise_an_exception(self): cmd = SetValueCommand(self.valid_parameters) try: cmd.execute() self.fail("Expected InvalidCmdParametersException was not raised.") except InvalidCmdParametersException: pass
def test_given_a_valid_parameters_then_should_set_the_value_in_the_soduko_board(self): game = Game() game.started = True game.user_sudoku = SudokuBoard(9) cmd = SetValueCommand(self.valid_parameters) cmd.set_game(game) cmd.execute() self.assertEqual(self.valid_value, game.user_sudoku.dic[self.cell].value)
def test_when_valid_parameters_and_valid_game_and_the_game_is_not_started_then_an_exception_should_be_trown_saying_the_game_is_not_starting(self): cmd = SetValueCommand(self.valid_parameters) game = Game() game.user_sudoku = SudokuBoard(3) cmd.set_game(game) try: cmd.execute() self.fail("Expected InvalidCmdParametersException was not raised.") except InvalidCmdParametersException: pass