Example #1
0
        public void Maze_Constructor_existing_maze_Test()
        {
            Maze maze = new Maze(startingPoint.Row, startingPoint.Column, basicMaze);

            Assert.That(maze, Is.Not.Null);
            Assert.That(maze.RowLength, Is.EqualTo(basicMaze.Length));
            Assert.That(maze.ColumnLength, Is.EqualTo(basicMaze[0].Length));
            Assert.That(maze.GetStartingPoint().Row, Is.EqualTo(startingPoint.Row));
            Assert.That(maze.GetStartingPoint().Column, Is.EqualTo(startingPoint.Column));

            char[][] existingMaze = maze.GetMaze();

            for (int i = 0; i < existingMaze.Length; i++)
            {
                for (int k = 0; k < existingMaze[i].Length; k++)
                {
                    Assert.That(existingMaze[i][k], Is.EqualTo(basicMaze[i][k]));
                }
            }
        }
Example #2
0
        public void Maze_Constructor_file_maze_Test()
        {
            Maze maze = new Maze(simpleWithExit);

            Assert.That(maze, Is.Not.Null);

            // note that the file is the same maze as the hardcoded char array basicMaze
            Assert.That(maze.RowLength, Is.EqualTo(basicMaze.Length));
            Assert.That(maze.ColumnLength, Is.EqualTo(basicMaze[0].Length));
            Assert.That(maze.GetStartingPoint().Row, Is.EqualTo(startingPoint.Row));
            Assert.That(maze.GetStartingPoint().Column, Is.EqualTo(startingPoint.Column));

            char[][] fileMaze = maze.GetMaze();

            for (int i = 0; i < fileMaze.Length; i++)
            {
                for (int k = 0; k < fileMaze[i].Length; k++)
                {
                    Assert.That(fileMaze[i][k], Is.EqualTo(basicMaze[i][k]));
                }
            }
        }