Esempio n. 1
0
        public void MarioRightSideShellTest()
        {
            //Make Mario, Shell, and Movement Command
            IMario      mario = new Mario(new Vector2(750, 500));
            IProjectile shell = new Shell(new Vector2(500, 500));

            level       = new Level(game);
            level.Mario = mario;
            ICommand moveLeft = new LeftCommand(level);

            //Move Mario Left until he has collided with the Shell
            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 Shell Test: Unsuccessful\n");
            }

            else
            {
                writer.WriteLine("Mario Right Side Shell Test: Successful\n");
            }
        }
Esempio n. 2
0
        public void MarioRightSideBlockTest()
        {
            //Make Mario, Block, and Movement Command
            IMario  mario = new Mario(new Vector2(750, 500));
            IObject block = new Block(new Vector2(500, 500));

            level       = new Level(game);
            level.Mario = mario;
            ICommand moveLeft = new LeftCommand(level);

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

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

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

            else
            {
                writer.WriteLine("Mario Right Side Block Test: Successful\n");
            }
        }
Esempio n. 3
0
        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");
            }
        }