public void UndoSingleStepSolutionsWhichReturnsEliminations_UndoesEliminations_Test()
        {
            var sudoku = (int[, ])_sudoku.Clone();

            sudoku[4, 7] = 0;

            var sudokuPuzzle = new SudokuPuzzle(sudoku);
            var strategyWhichReducesCandidates = new BasicElimination();

            sudokuPuzzle.ApplySingleStepSolution(strategyWhichReducesCandidates.SolveSingleStep(sudokuPuzzle));
            Assert.That(sudokuPuzzle.Cells[4, 7].CanBe.Single(), Is.EqualTo(5));

            var step = sudokuPuzzle.UndoLastSingleStepSolution();

            Assert.That(step.Eliminations, Is.Not.Empty);
            Assert.That(step.Result, Is.Null);
            Assert.That(step.Strategy, Is.EqualTo(strategyWhichReducesCandidates.StrategyName));
            Assert.That(step.SolutionDescription, Is.Not.Empty);
            CollectionAssert.AreEqual(sudokuPuzzle.Cells[4, 7].CanBe, new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 });
        }
        public void UndoSingleStepSolutionsWhichReturnsResult_UndoesResult_Test()
        {
            var sudoku = (int[, ])_sudoku.Clone();

            sudoku[4, 7] = 0;

            var sudokuPuzzle             = new SudokuPuzzle(sudoku);
            var strategyWhichFindsResult = new HiddenSingle();

            sudokuPuzzle.ApplySingleStepSolution(strategyWhichFindsResult.SolveSingleStep(sudokuPuzzle));
            Assert.That(sudokuPuzzle.Cells[4, 7].Value, Is.EqualTo(5));

            var step = sudokuPuzzle.UndoLastSingleStepSolution();

            Assert.That(step.Eliminations, Is.Null);
            Assert.That(step.Result, Is.Not.Null);
            Assert.That(step.Result.IndexOfRow, Is.EqualTo(4));
            Assert.That(step.Result.IndexOfColumn, Is.EqualTo(7));
            Assert.That(step.Strategy, Is.EqualTo(strategyWhichFindsResult.StrategyName));
            Assert.That(step.SolutionDescription, Is.Not.Empty);
            Assert.That(sudokuPuzzle.Cells[4, 7].Value, Is.EqualTo(0));
        }
        public void UndoLastSingleStepSolution_WhenNoSolutionWasApplied_ReturnsNull_Test()
        {
            var sudokuPuzzle = new SudokuPuzzle(_sudoku);

            Assert.That(sudokuPuzzle.UndoLastSingleStepSolution(), Is.Null);
        }