예제 #1
0
        public void ShouldReturnNoNeighborsIfNoDestroyedWalls()
        {
            MazeSolver solver = new MazeSolver(BuildMaze(3, 3));
            MazeSlot   slot   = new MazeSlot(1, 1);

            List <MazeSlot> moves = solver.NextMoves(slot);

            Assert.Empty(moves);
        }
예제 #2
0
        public void ShouldIgnoreSamePositionOnDestroyWall()
        {
            MazeSlot slot        = new MazeSlot(1, 1);
            MazeSlot anotherSlot = new MazeSlot(1, 1);

            slot.DestroyWall(anotherSlot);

            Assert.Empty(slot.DestroyedWalls);
        }
예제 #3
0
        public void ShouldSetCorrectWallOnDestroyWall(int anotherX, int anotherY, WallPosition expectedPosition)
        {
            MazeSlot slot        = new MazeSlot(1, 1);
            MazeSlot anotherSlot = new MazeSlot(anotherX, anotherY);

            slot.DestroyWall(anotherSlot);

            Assert.Single(slot.DestroyedWalls);
            Assert.Contains(expectedPosition, slot.DestroyedWalls);
        }
예제 #4
0
        public void ShouldIgnoreVisitedNeighbors(int x, int y)
        {
            MazeSlot[,] maze = BuildMaze(3, 3);
            MazeSolver solver = new MazeSolver(maze);

            MazeSlot slot = new MazeSlot(1, 1);

            slot.DestroyWall(maze[x, y]);
            maze[x, y].VisitedBySolver = true;

            List <MazeSlot> moves = solver.NextMoves(slot);

            Assert.Empty(moves);
        }
예제 #5
0
        public void ShouldReturnCorrectNeighbors(int x, int y, WallPosition expectedWall)
        {
            MazeSlot[,] maze = BuildMaze(3, 3);
            MazeSolver solver = new MazeSolver(maze);

            MazeSlot slot = new MazeSlot(1, 1);

            slot.DestroyWall(maze[x, y]);

            List <MazeSlot> moves = solver.NextMoves(slot);

            Assert.Single(moves);
            Assert.Contains(expectedWall, slot.DestroyedWalls);
        }