Exemple #1
0
        public void Validate_Sudoku_Input_String()
        {
            var  sudoku = "85...24..72......9..4.........1.7..23.5...9...4...........8..7..17..........36.4.";
            bool actual = SudokuGenerator.IsInputSudokuValid(sudoku);

            Assert.IsTrue(actual, "Valid sudoku - Length and allowed degits/characters [0-9.]");
        }
Exemple #2
0
        public void When_Invalid_Sudoku_Search_To_Fail()
        {
            var  sudokuWithInvalidPositions = "44....8.5.3..........7......2.....6.....8.4......1.......6.3.7.5..2.....1.4......";
            bool actual = SudokuGenerator.IsInputSudokuValid(sudokuWithInvalidPositions);

            Assert.IsTrue(actual, "Valid length, degits in sudoku");

            //Populate list will be called once
            var sortedList = SudokuGenerator.PopulateGridWithPossibleValues(sudokuWithInvalidPositions);

            Assert.AreEqual(1, sortedList == null ? 0 : 1, "Populating grid with possible values successfull");

            //Search will be called and will retun null as result
            sortedList = SudokuGenerator.Search(sortedList);
            Assert.AreEqual(0, sortedList == null ? 0 : 1, "Search fails as only choice fails for the second degit and retuns null as output");
        }