Esempio n. 1
0
 def testIfTryToUpdateDataInAnInvalidColumnThenShouldTrowAnException(self):
     sudoku = SudokuBoard()
     try:
         sudoku.set_value('A', 10, '5')
         self.fail("Did not raise the exception InvalidColumnException")
     except InvalidColumnException:
         pass
Esempio n. 2
0
 def testWhenTryToSetAnInvalidValueThehnShouldRaiseanException(self):
     sudoku = SudokuBoard(3)
     try:
         sudoku.set_value('C', 2, '5')
         self.fail("Did not raise the exception InvalidParameterValueException")
     except InvalidParameterValueException:
         pass
Esempio n. 3
0
 def testWhenTrySetDateInCorrectAndNonEditableCellThenShouldThrownAnException(self):
     sudoku = SudokuBoard(3)
     sudoku.set_editable('C', 2, False)
     try:
         sudoku.set_value('C', 2, '2')
         self.fail("Did not raise the exception CellNotEditableException")
     except CellNotEditableException:
         pass
Esempio n. 4
0
 def test_given_a_sudoku_table_then_should_convert_it_to_dictionary(self):
     sudoku = SudokuBoard(3)
     rows = ['A', 'B', 'C']
     cols = range(1, 4)
     for row in rows:
         for col in cols:
             sudoku.set_value(row, col, self.dic_with_data[row + str(col)])
             
     dictionary = sudoku.to_dictionary()
     self.assertDictEqual(self.dic_with_data, dictionary)
Esempio n. 5
0
 def testWhenTrySetDataInCorrectAndEditableCellThenShouldSetDataProperly(self):
     sudoku = SudokuBoard(3)
     sudoku.set_value('C', 2, '2')
     self.assertEqual('2', sudoku.dic['C2'].get_value())
Esempio n. 6
0
 def testIfTryToAddDataInRightCellThenShouldAddTheDataProperly(self):
     sudoku = SudokuBoard(18)
     sudoku.set_value('B', 2, '5')
     
     self.assertEqual('5', sudoku.dic['B2'].get_value())