Example #1
0
        public void SolveMaze_ValidSolution_ReturnsCorrectPath()
        {
            // arrange
            int[,] maze = new int[,]
            {
                {0, 1, 1, 0, 0 },
                {0, 0, 1, 0, 1 },
                {1, 0, 0, 0, 1 },
                {2, 1, 1, 0, 0 },
                {0, 0, 0, 0, 1 },
            };
            string expected = "BRBRRBBLLLT";
            GraphSolver solver = new GraphSolver();

            // act
            string actual = solver.SolveMaze(maze);

            // assert
            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void ShortestPath_TwoSolutions_SelectsCorrectSolution()
        {
            // arrange
            int[,] map = new int[,]
            {
                {0, 1, 1, 0, 0 },
                {0, 0, 1, 0, 1 },
                {1, 0, 0, 0, 1 },
                {2, 0, 1, 0, 0 },
                {0, 0, 0, 0, 1 },
            };
            string expected = "BRBBL";
            GraphSolver solver = new GraphSolver();

            // act
            string actual = solver.ShortestPath(map);

            // assert
            Assert.AreEqual(expected, actual);
        }