public void MarioBelowShellTest() { //Make Mario, Shell, and Movement Command IMario mario = new Mario(new Vector2(500, 750)); IProjectile shell = new Shell(new Vector2(500, 500)); level = new Level(game); level.Mario = mario; ICommand moveUp = new UpCommand(level); //Move Mario Up until he has collided with the Shell Rectangle marioPosition = mario.DrawnRectangle; while (marioPosition.Y > 490) { moveUp.Execute(); level.Update(); marioPosition = mario.DrawnRectangle; } //Check test results, Mario should die if (!mario.IsDead()) { writer.WriteLine("Mario Below Shell Test: Unsuccessful\n"); } else { writer.WriteLine("Mario Below Shell Test: Successful\n"); } }
public void MarioBelowKoopaTest() { //Make Mario, Koopa, and Movement Command IMario mario = new Mario(new Vector2(500, 750)); //IEnemies koopa = new Koopa(new Vector2(500, 500)); level = new Level(game); level.Mario = mario; ICommand moveUp = new UpCommand(level); //Move Mario Up until he has jumped past the Koopa Rectangle marioPosition = mario.DrawnRectangle; while (marioPosition.Y > 490) { moveUp.Execute(); level.Update(); marioPosition = mario.DrawnRectangle; } //Check test results, Mario should die if (!mario.IsDead()) { writer.WriteLine("Mario Below Koopa Test: Unsuccessful\n"); } else { writer.WriteLine("Mario Below Koopa Test: Successful\n"); } }
public void MarioRightSideKoopaTest() { //Make Mario, Koopa, and Movement Command IMario mario = new Mario(new Vector2(750, 500)); IEnemy koopa = new Koopa(new Vector2(500, 500)); level = new Level(game); level.Mario = mario; ICommand moveLeft = new LeftCommand(level); //Move Mario Left until he has run past the Koopa Rectangle marioPosition = mario.DrawnRectangle; while (marioPosition.X > 490) { moveLeft.Execute(); level.Update(); marioPosition = mario.DrawnRectangle; } //Check test results, Mario should die if (!mario.IsDead()) { writer.WriteLine("Mario Right Side Koopa Test: Unsuccessful\n"); } else { writer.WriteLine("Mario Right Side Koopa Test: Successful\n"); } }
public void MarioAboveKoopaTest() { //Make Mario, Koopa, and Movement Command IMario mario = new Mario(new Vector2(500, 250)); IEnemy koopa = new Koopa(new Vector2(500, 500)); level = new Level(game); level.Mario = mario; ICommand moveDown = new DownCommand(level); //Move Mario Down until he has fallen past the Koopa Rectangle marioPosition = mario.DrawnRectangle; while (marioPosition.Y < 500 - marioPosition.Height) { moveDown.Execute(); level.Update(); marioPosition = mario.DrawnRectangle; } //Check test results, Mario should live if (mario.IsDead()) { writer.WriteLine("Mario Above Koopa Test: Unsuccessful\n"); } else { writer.WriteLine("Mario Above Koopa Test: Successful\n"); } }
public void MarioLeftSideGoombaTest() { //Make Mario, Goomba, and Movement Command IMario mario = new Mario(new Vector2(250, 500)); //IEnemies goomba = new Goomba(new Vector2(500, 500)); level = new Level(game); level.Mario = mario; ICommand moveRight = new RightCommand(level); //Move Mario Right until he has run past the Goomba Rectangle marioPosition = mario.DrawnRectangle; while (marioPosition.X < 510) { moveRight.Execute(); level.Update(); marioPosition = mario.DrawnRectangle; } //Check test results, Mario should die if (!mario.IsDead()) { writer.WriteLine("Mario Left Side Goomba Test: Unsuccessful\n"); } else { writer.WriteLine("Mario Left Side Goomba Test: Successful\n"); } }