Ejemplo n.º 1
0
 def test_when_valid_parameters_and_none_game_then_an_exception_should_be_trown(self):
     cmd = StopCommand(None)
     try:
         cmd.execute()
         self.fail("Expected InvalidCmdParametersException was not raised.")
     except InvalidCmdParametersException:
         pass
Ejemplo n.º 2
0
 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 = {}
     game = Game()
     game.started = False
     cmd = StopCommand(dict)
     cmd.set_game(game)
     
     try:
         cmd.execute()
         self.fail("Expected InvalidCmdParametersException was not raised.")
     except InvalidCmdParametersException:
         pass
Ejemplo n.º 3
0
    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.startTime = time.clock()
        game.currentTime = 0
        game.user_sudoku = user_sudoku
        
        cmd = StopCommand(None)
        cmd.set_game(game)
        timee = cmd.execute()

        self.assertFalse(game.started)
        self.assertTrue(timee != 0.0)