Пример #1
0
        public void MarioAboveShellTest()
        {
            //Make Mario, Shell, and Movement Command
            IMario      mario = new Mario(new Vector2(500, 250));
            IProjectile shell = new Shell(new Vector2(500, 500));

            level       = new Level(game);
            level.Mario = mario;
            ICommand moveDown = new DownCommand(level);

            //Move Mario Down until he has collided with the Shell
            Rectangle marioPosition = mario.DrawnRectangle;

            while (marioPosition.Y < 510)
            {
                moveDown.Execute();
                level.Update();
                marioPosition = mario.DrawnRectangle;
            }

            //Check test results, Mario should live
            if (mario.IsDead())
            {
                writer.WriteLine("Mario Above Shell Test: Unsuccessful\n");
            }

            else
            {
                writer.WriteLine("Mario Above Shell Test: Successful\n");
            }
        }
Пример #2
0
        public void MarioAboveBlockTest()
        {
            //Make Mario, Block, and Movement Command
            IMario  mario = new Mario(new Vector2(500, 250));
            IObject block = new Block(new Vector2(500, 500));

            level       = new Level(game);
            level.Mario = mario;
            ICommand moveDown = new DownCommand(level);

            //Move Mario Down until he has collided with the Block's space
            Rectangle marioPosition = mario.DrawnRectangle;

            while ((marioPosition.Y + mario.DrawnRectangle.Height) < 500)
            {
                moveDown.Execute();
                level.Update();
                marioPosition = mario.DrawnRectangle;
            }

            //Check test results, Mario should stop
            if ((marioPosition.Y + mario.DrawnRectangle.Height) > 500)
            {
                writer.WriteLine("Mario Above Block Test: Unsuccessful\n");
            }

            else
            {
                writer.WriteLine("Mario Above Block Test: Successful\n");
            }
        }
Пример #3
0
        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");
            }
        }