//[DataRow(@"C:\Users\ia_no\Source\Repos\CodeTechnologyLabs_course3\MazeOperations.Tests\TestInput\labirint5.txt", false)] //[DataRow(@"C:\Users\ia_no\Source\Repos\CodeTechnologyLabs_course3\MazeOperations.Tests\TestInput\output.txt", true)] //[DataRow(@"C:\Users\ia_no\Source\Repos\CodeTechnologyLabs_course3\MazeOperations.Tests\TestInput\test_outOfRange.txt", false)] #endregion public void RunSolutionTest_Solution_true(string labirintFilePath, bool correct) { //arrange var expectedPassed = correct; var io = new MazeIO(); io.ReadMazeFromFileTaskAsync(labirintFilePath); var map = io.CreateMazeMatrix(); var startPlace = map.StartCellPosition; var exitPlace = map.ExitCellPosition; //act var solver = new MazePathFinder(map); var tester = new MazePathSolutionTester(map, startPlace, exitPlace); var solution = solver.GetCellsPath(startPlace, exitPlace); var actualPassed = tester.RunSolutionTest(solution); //assert Assert.AreEqual(expectedPassed, actualPassed); }
private bool Run() { MazeInputOutput = new MazeIO(); MazeInputOutput.ReadMazeFromFileTaskAsync(_mazeMapFilePath); try { Maze = MazeInputOutput.CreateMazeMatrix(); StartPlace = Maze.StartCellPosition; ExitPlace = Maze.ExitCellPosition; } catch (Exception e) { Console.WriteLine(e.Message); } Tester = new MazePathSolutionTester(Maze, StartPlace, ExitPlace); Finder = new MazePathFinder(Maze); Solution = Finder.GetCellsPath(StartPlace, ExitPlace); if (Tester.RunSolutionTest(Solution)) { Console.OutputEncoding = System.Text.Encoding.Unicode; PrintMazeMap(Maze.Height, Maze.Width, Maze.MazeCells); for (var i = 0; i < Solution.Count - 1; i++) { PrintSolutionPath(Solution[i], Solution[i + 1]); } PrintStartFinishLabels(StartPlace, ExitPlace); } else { return(false); } return(true); }