Exemple #1
0
 def test_an_InvalidCmdParametersException_should_be_raised_if_parameter_has_int_value(self):
     with self.assertRaises(InvalidCmdParametersException):
         game = Game()
         game.initial_sudoku = SudokuBoard()
         cmd = SolveGameCommand(self.int_param)
         cmd.set_game(game)
         cmd.execute()
Exemple #2
0
 def test_sudoku_puzzle_should_be_solved_when_no_solving_algorithm_is_specified(self):
     settings_manager = SettingsManager('mySettings.xml')
     settings_manager.load()
     game = Game()
     game.set_settings_manager(settings_manager)
     game.initial_sudoku = SudokuBoard()
     game.initial_sudoku.from_dictionary(self.puzzle, True)
     cmd = SolveGameCommand()
     cmd.set_game(game)
     cmd.execute()
     solving_algorithm = Recursive()
     expected_results = solving_algorithm.solve(self.puzzle)
     self.assertEqual(expected_results, game.solved_sudoku.to_dictionary())
Exemple #3
0
 def test_an_InvalidCmdParametersException_should_be_raised_if_initial_sudoku_is_None(self):
     with self.assertRaises(InvalidCmdParametersException):
         game = Game()
         cmd = SolveGameCommand(self.valid_params)
         cmd.set_game(game)
         cmd.execute()
Exemple #4
0
 def test_an_InvalidCmdParametersException_should_be_raised_if_too_many_parameters_are_given(self):
     with self.assertRaises(InvalidCmdParametersException):
         game = Game()
         cmd = SolveGameCommand(self.too_many_params)
         cmd.set_game(game)
         cmd.execute()
Exemple #5
0
 def test_an_InvalidCmdParametersException_should_be_raised_if_game_is_None(self):
     with self.assertRaises(InvalidCmdParametersException):
         cmd = SolveGameCommand(self.valid_params)
         cmd.execute()