Example #1
0
        public void MarioLeftSideShellTest()
        {
            //Make Mario, Shell, and Movement Command
            IMario      mario = new Mario(new Vector2(250, 500));
            IProjectile shell = new Shell(new Vector2(500, 500));

            level       = new Level(game);
            level.Mario = mario;
            ICommand moveRight = new RightCommand(level);

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

            else
            {
                writer.WriteLine("Mario Left Side Shell Test: Successful\n");
            }
        }
Example #2
0
        public void MarioCoinTest()
        {
            //Make Mario, Coin, and Movement Command
            IMario mario = new Mario(new Vector2(250, 500));
            IItem  coin  = new Coin(new Vector2(500, 500));

            level       = new Level(game);
            level.Mario = mario;
            ICommand moveRight = new RightCommand(level);

            //Move Mario Right until he has collided with the Coin
            Vector2 marioPosition = mario.CurrentPosition;

            while (marioPosition.X < 510)
            {
                moveRight.Execute();
                level.Update();
                marioPosition = mario.CurrentPosition;
            }

            //Check test results, no expected change for Mario

            //Output successful test
            writer.WriteLine("Mario Coin Test: Successful\n");
        }
Example #3
0
        public void MarioFlowerTest()
        {
            //Make Mario, Flower, and Movement Command
            IMario mario  = new Mario(new Vector2(250, 500));
            IItem  flower = new FireFlower(new Vector2(500, 500));

            level       = new Level(game);
            level.Mario = mario;
            ICommand moveRight = new RightCommand(level);

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

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

            //Check test results, Mario should be Fire type
            if (!mario.IsFire())
            {
                writer.WriteLine("Mario Flower Test: Unsuccessful\n");
            }

            else
            {
                writer.WriteLine("Mario Flower Test: Successful\n");
            }
        }
Example #4
0
        public void MarioMushroomTest()
        {
            //Make Mario, Mushroom, and Movement Command
            IMario mario    = new Mario(new Vector2(250, 500));
            IItem  mushroom = new GreenMushroom(new Vector2(500, 500));

            level       = new Level(game);
            level.Mario = mario;
            ICommand moveRight = new RightCommand(level);

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

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

            //Check test results, Mario should be big
            if (!mario.IsBig())
            {
                writer.WriteLine("Mario Mushroom Test: Unsuccessful\n");
            }

            else
            {
                writer.WriteLine("Mario Mushroom Test: Successful\n");
            }
        }
Example #5
0
        public void MarioLeftSideKoopaTest()
        {
            //Make Mario, Koopa, and Movement Command
            IMario mario = new Mario(new Vector2(250, 500));
            IEnemy koopa = new Koopa(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 Koopa
            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 Koopa Test: Unsuccessful\n");
            }

            else
            {
                writer.WriteLine("Mario Left Side Koopa Test: Successful\n");
            }
        }
Example #6
0
        public void MarioLeftSideBlockTest()
        {
            //Make Mario, Block, and Movement Command
            IMario  mario = new Mario(new Vector2(250, 500));
            IObject block = new Block(new Vector2(500, 500));

            level       = new Level(game);
            level.Mario = mario;
            ICommand moveRight = new RightCommand(level);

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

            while ((marioPosition.X + mario.DrawnRectangle.Width) < 500)
            {
                moveRight.Execute();
                level.Update();
                marioPosition = mario.DrawnRectangle;
            }

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

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