Beispiel #1
0
        public void SmallMarioGoombaTopSideCollisionTest()
        {
            IMario testMario = new MarioInstance(game);

            Goomba testGoomba = new Goomba(game);

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

            expectedGoomba.Hit();

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

            collisionHandler.HandleCollision();

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

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