public void A_game_with_some_constraints_should_be_solved() { var game = new SudokuGame(); game.SetConstrainedCell(new Coords(2, 2), 5); game.SetConstrainedCell(new Coords(5, 5), 5); game.SetConstrainedCell(new Coords(8, 8), 5); game.UnsetConstrainedCell(new Coords(8, 8)); game.SetConstrainedCell(new Coords(1, 1), 1); game.SetConstrainedCell(new Coords(3, 1), 2); game.SetConstrainedCell(new Coords(5, 1), 3); game.SetConstrainedCell(new Coords(1, 3), 4); game.SetConstrainedCell(new Coords(3, 3), 6); game.SetConstrainedCell(new Coords(5, 3), 7); var iterator = game.GetLinearIterator(); var solver = new SudokuGameSolver(iterator, game); var result = solver.Solve(); Assert.AreEqual(SolveResults.Solved, result); Assert.AreEqual(5, game.GetCellAt(new Coords(2, 2)).CurrentValue); Assert.AreEqual(5, game.GetCellAt(new Coords(5, 5)).CurrentValue); Assert.AreNotEqual(5, game.GetCellAt(new Coords(8, 8)).CurrentValue); }
public void An_empty_game_should_be_solved() { var game = new SudokuGame(); var iterator = game.GetLinearIterator(); var solver = new SudokuGameSolver(iterator, game); var result = solver.Solve(); Assert.AreEqual(SolveResults.Solved, result); }