def test_when_valid_parameters_and_none_game_then_an_exception_should_be_trown(self): cmd = PauseCommand(None) try: cmd.execute() self.fail("Expected InvalidCmdParametersException was not raised.") except InvalidCmdParametersException: pass
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 ): dict = {} cmd = PauseCommand(dict) game = Game() cmd.set_game(game) try: cmd.execute() self.fail("Expected InvalidCmdParametersException was not raised.") except InvalidCmdParametersException: pass
def test_when_valid_parameters_and_valid_game_and_the_game_is_started_then_should_the_game_be_stopped(self): user_sudoku = SudokuBoard(3) game = Game() game.started = True game.paused = False game.startTime = time.clock() game.currentTime = 0 game.user_sudoku = user_sudoku cmd = PauseCommand(None) cmd.set_game(game) timee = cmd.execute() self.assertTrue(game.is_paused()) self.assertTrue(timee != 0.0)