public void Command_Initialize_MoveUp() { var mazeBuilder = new SmallMazeCreator(); this.player.Maze = mazeBuilder.CreateMaze(); mazeBuilder.GenerateMaze(); this.player.Score = new PlayerScore(); this.command = CommandCreator.CreateMoveCommand(this.player, "u"); this.command.Execute(); if (this.player.Maze.PlayerPosition.X == (this.player.Maze.Rows / 2) - 1) { Assert.IsTrue(this.player.PlayerMoved); } else { Assert.IsFalse(this.player.PlayerMoved); } }
public void Command_Initialize_MoveRight() { var mazeBuilder = new SmallMazeCreator(); this.player.Maze = mazeBuilder.CreateMaze(); mazeBuilder.GenerateMaze(); this.player.Score = new PlayerScore(); this.commander.SetCommand(CommandCreator.CreateMoveCommand(this.player, "r")); this.commander.ExecuteCommand(); if (this.player.Maze.PlayerPosition.Y == (this.player.Maze.Cols / 2) + 1) { Assert.IsTrue(this.player.PlayerMoved); } else { Assert.IsFalse(this.player.PlayerMoved); } }
public void Player_TestOutOfMazeMoveRight() { var mazeBuilder = new SmallMazeCreator(); IMaze maze = mazeBuilder.CreateMaze(); mazeBuilder.GenerateMaze(); maze.PlayerPosition.X = 9; maze.PlayerPosition.Y = 9; this.player.Maze = maze; this.player.Score = new PlayerScore(); this.player.ExecuteCommand("r"); if (maze[9, 10].IsEmpty) { Assert.IsTrue(this.player.IsOutOfTheMaze()); } else { Assert.IsFalse(this.player.IsOutOfTheMaze()); } }