private async void LoadSudokuFromFile_FileOk(object sender, System.ComponentModel.CancelEventArgs e) { _model.CurrentSudoku = await SudokuAdapter.ReadFromFileAsync(LoadSudokuFromFile.FileName); UpdateLabelsUi(); _model.IsSolveAvailable = true; }
public async Task SolveTest(string path, int solutionsCount) { var absPath = Path.Combine(TestContext.CurrentContext.TestDirectory, path); var sudoku = await SudokuAdapter.ReadFromFileAsync(absPath); var solver = new SimpleSolver(); var actualSolutionsCount = solver.CountSolutions(sudoku); Assert.AreEqual(solutionsCount, actualSolutionsCount); }
public async Task TestTopNSolutions(string path, int solutionsLimit, Enums.TopType type, int expectedDifficulty) { var absPath = Path.Combine(TestContext.CurrentContext.TestDirectory, path); var sudoku = await SudokuAdapter.ReadFromFileAsync(absPath); var solver = new SimpleSolver(); var solutions = solver.GetTopNSolutions(sudoku, solutionsLimit, type); Assert.AreEqual(solutionsLimit, solutions.Count); Assert.AreEqual(expectedDifficulty, solutions.First().DifficultyPoints); }