Exemplo n.º 1
0
 def test_when_an_about_cmd_is_created_with_None_parameter_then_should_pass_validation(self):
     try:
         about = About(None)
         result = about.execute()
         self.assertNotEqual(0, len(result))
     except InvalidCmdParametersException:
         self.fail("The initializer should not raise an exception.")
Exemplo n.º 2
0
    def getCommand(self, cmdName, params):
        '''
        @return: return the command
        '''
        if self.ABOUT_COMMAND == cmdName:
            cmd = About(params)
        elif self.RESTART_GAME_COMMAND == cmdName:
            cmd = RestartGameCommand(params)
        elif self.READ_CONFIGURATION_COMMAND == cmdName:
            cmd = ReadConfigurationCommand(params)
        elif self.HINT_COMMAND == cmdName:
            cmd = HintCommand(params)
        elif self.SET_VALUE_COMMAND == cmdName:
            cmd = SetValueCommand(params)
        elif self.PRINT_COMMAND == cmdName:
            cmd = PrintBoardCommand(params)
        elif self.QUIT_COMMAND == cmdName:
            cmd = QuitCommand(params)
        elif self.GENERATE_COMMAND == cmdName:
            cmd = GenerateGameCommand(params)
        elif self.START_COMMAND == cmdName:
            cmd = StartCommand(params)
        elif self.STOP_COMMAND == cmdName:
            cmd = StopCommand(params)
        elif self.PAUSE_COMMAND == cmdName:
            cmd = PauseCommand(params)
        elif self.SOLVE_COMMAND == cmdName:
            cmd = SolveGameCommand(params)
        elif self.IMPORT_COMMAND == cmdName:
            cmd = ImportCommand(params)
        elif self.EXPORT_COMMAND == cmdName:
            cmd = ExportCommand(params)
        elif self.SAVE_COMMAND == cmdName:
            cmd = SaveGameCommand(params)
        elif self.OPEN_COMMAND == cmdName:
            cmd = OpenGameCommand(params)
        
        cmd.set_game(self.game)

        return cmd