Пример #1
0
        public void TestSolve_Empty()
        {
            PuzzleMonolithic puzzle = new PuzzleMonolithic();

            puzzle.Solve();
            DisplayPuzzle(puzzle);
            Assert.IsTrue(puzzle.IsSolved());
        }
Пример #2
0
        public void TestIsPuzzleSolved_True()
        {
            PuzzleMonolithic puzzle = new PuzzleMonolithic();

            PopulateSolvedValues(puzzle);
            DisplayPuzzle(puzzle);
            Assert.IsTrue(puzzle.IsSolved());
        }
Пример #3
0
        public void TestIsPuzzleSolved_False()
        {
            PuzzleMonolithic puzzle = new PuzzleMonolithic();

            PopulateRandomValues(puzzle);
            DisplayPuzzle(puzzle);
            Assert.IsFalse(puzzle.IsSolved());
        }
Пример #4
0
        public void TestSolve_Hardest()
        {
            PuzzleMonolithic puzzle = new PuzzleMonolithic();

            PopulateHardestValues(puzzle);
            DisplayPuzzle(puzzle);

            puzzle.Solve();
            Console.WriteLine();
            Console.WriteLine();
            DisplayPuzzle(puzzle);
            Assert.IsTrue(puzzle.IsSolved());
        }
Пример #5
0
        public void TestSolve_AllLocked()
        {
            PuzzleMonolithic puzzle = new PuzzleMonolithic();

            PopulateSolvedValues(puzzle);
            LockAllCellValues(puzzle);
            DisplayPuzzle(puzzle);

            puzzle.Solve();
            Console.WriteLine();
            Console.WriteLine();
            DisplayPuzzle(puzzle);
            Assert.IsTrue(puzzle.IsSolved());
        }
Пример #6
0
        public void TestSolve_Locked_3()
        {
            PuzzleMonolithic puzzle = new PuzzleMonolithic();

            PopulateSolvedValues(puzzle);
            LockAllCellValues(puzzle);
            DisplayPuzzle(puzzle);

            // Unlock the last two values
            puzzle.GetCell(0, 0).IsLocked = false;
            puzzle.GetCell(0, 1).IsLocked = false;

            puzzle.Solve();
            Console.WriteLine();
            Console.WriteLine();
            DisplayPuzzle(puzzle);
            Assert.IsTrue(puzzle.IsSolved());
        }