public void TestPuzzleRefresh() { int dimension = 3; List <int> cellValues = new List <int>(); for (int i = 0; i < dimension * dimension * dimension * dimension; ++i) { cellValues.Add(0); } SudokuPuzzle puzzle = new SudokuPuzzle(dimension, cellValues); Assert.IsFalse(puzzle.Refresh()); puzzle.Rows[0][0].RemoveAllExcept(1); Assert.IsTrue(puzzle.Refresh()); Assert.IsFalse(puzzle.Refresh()); foreach (Cell cell in puzzle.Rows[0]) { if (cell.Count != 1) { Assert.IsFalse(cell.AllowedValues.ContainsKey(1)); } } puzzle.Columns[1][1].RemoveAllExcept(2); Assert.IsTrue(puzzle.Refresh()); Assert.IsFalse(puzzle.Refresh()); foreach (Cell cell in puzzle.Columns[1]) { if (cell.Count != 1) { Assert.IsFalse(cell.AllowedValues.ContainsKey(2)); } } puzzle.Blocks[2][2].RemoveAllExcept(3); Assert.IsTrue(puzzle.Refresh()); Assert.IsFalse(puzzle.Refresh()); foreach (Cell cell in puzzle.Blocks[2]) { if (cell.Count != 1) { Assert.IsFalse(cell.AllowedValues.ContainsKey(3)); } } }