Esempio n. 1
0
        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");
            }
        }
Esempio n. 2
0
        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");
            }
        }
Esempio n. 3
0
        public void MarioBelowBlockTest()
        {
            //Make Mario, Block, and Movement Command
            IMario  mario = new Mario(new Vector2(500, 750));
            IObject block = new Block(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 Block's space
            Rectangle marioPosition = mario.DrawnRectangle;

            while ((marioPosition.Y - block.DrawnRectangle.Y) > 500)
            {
                moveUp.Execute();
                level.Update();
                marioPosition = mario.DrawnRectangle;
            }

            //Check test results, Mario should stop
            if ((marioPosition.Y - block.DrawnRectangle.Y) < 500)
            {
                writer.WriteLine("Mario Below Block Test: Unsuccessful\n");
            }

            else
            {
                writer.WriteLine("Mario Below Block Test: Successful\n");
            }
        }