Exemplo n.º 1
0
        public void StarSmallMarioGoombaTopCollisionTest()
        {
            WorldManager.LoadListFromFile("World1-1", game);
            IMario testMario = WorldManager.GetMario();

            testMario.Star();
            testMario = WorldManager.GetMario();
            testMario.VectorCoordinates = new Vector2(0, 0);

            Goomba testGoomba = new Goomba(game);

            testGoomba.VectorCoordinates = new Vector2(0, 14);
            Goomba expectedGoomba = new Goomba(game);

            expectedGoomba.Flipped();

            ICollisionSide             side             = new TopSideCollision();
            CollisionData              collision        = new CollisionData(testMario, testGoomba, side);
            MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision);

            collisionHandler.HandleCollision();

            bool    testState        = testGoomba.state is GoombaFlippedState;
            bool    expectedState    = expectedGoomba.state is GoombaFlippedState;
            Vector2 testLocation     = testMario.VectorCoordinates;
            Vector2 expectedLocation = new Vector2(0, -1);

            Assert.AreEqual(testState, expectedState);
            Assert.AreEqual(testLocation, expectedLocation);
        }