public void NormalMarioKoopaLeftSideCollisionTest() { MarioInstance testMario = new MarioInstance(game); MarioInstance expectedMario = new MarioInstance(game); expectedMario.VectorCoordinates = new Vector2(-1, 0); testMario.MarioState = new NormalRightIdleState(testMario); expectedMario.MarioState = new NormalRightIdleState(expectedMario); expectedMario.Damage(); GreenKoopa testGreenKoopa = new GreenKoopa(game); testGreenKoopa.VectorCoordinates = new Vector2(14, 0); ICollisionSide side = new LeftSideCollision(); CollisionData collision = new CollisionData(testMario, testGreenKoopa, side); MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision); collisionHandler.HandleCollision(); bool testState = testMario.MarioState is SmallRightIdleState; bool expectedState = expectedMario.MarioState is SmallRightIdleState; Vector2 testLocation = testMario.VectorCoordinates; Vector2 expectedLocation = expectedMario.VectorCoordinates; Assert.AreEqual(testState, expectedState); Assert.AreEqual(testLocation, expectedLocation); }
public void FireMarioGoombaRightSideCollisionTest() { IMario testMario = new MarioInstance(game); testMario.VectorCoordinates = new Vector2(14, 0); IMario expectedMario = new MarioInstance(game); expectedMario.VectorCoordinates = new Vector2(16, 0); testMario.MarioState = new FireRightIdleState(testMario); expectedMario.MarioState = new FireRightIdleState(expectedMario); expectedMario.Damage(); Goomba testGoomba = new Goomba(game); ICollisionSide side = new RightSideCollision(); CollisionData collision = new CollisionData(testMario, testGoomba, side); MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision); collisionHandler.HandleCollision(); bool testState = testMario.MarioState is NormalRightIdleState; bool expectedState = expectedMario.MarioState is NormalRightIdleState; Vector2 testLocation = testMario.VectorCoordinates; Vector2 expectedLocation = expectedMario.VectorCoordinates; Assert.AreEqual(testState, expectedState); Assert.AreEqual(testLocation, expectedLocation); }
public void SmallMarioGoombaBottomSideCollisionTest() { IMario testMario = new MarioInstance(game); testMario.VectorCoordinates = new Vector2(0, 14); IMario expectedMario = new MarioInstance(game); expectedMario.VectorCoordinates = new Vector2(0, 16); expectedMario.Damage(); Goomba testGoomba = new Goomba(game); ICollisionSide side = new BottomSideCollision(); CollisionData collision = new CollisionData(testMario, testGoomba, side); MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision); collisionHandler.HandleCollision(); bool testState = testMario.MarioState is DeadMarioState; bool expectedState = expectedMario.MarioState is DeadMarioState; Vector2 testLocation = testMario.VectorCoordinates; Vector2 expectedLocation = expectedMario.VectorCoordinates; Assert.AreEqual(testState, expectedState); Assert.AreEqual(testLocation, expectedLocation); }
public void FireMarioKoopaBottomSideCollisionTest() { IMario testMario = new MarioInstance(game); testMario.VectorCoordinates = new Vector2(0, 19); IMario expectedMario = new MarioInstance(game); expectedMario.VectorCoordinates = new Vector2(0, 21); expectedMario.Damage(); GreenKoopa testGreenKoopa = new GreenKoopa(game); ICollisionSide side = new BottomSideCollision(); CollisionData collision = new CollisionData(testMario, testGreenKoopa, side); MarioEnemyCollisionHandler collisionHandler = new MarioEnemyCollisionHandler(collision); collisionHandler.HandleCollision(); bool testState = testMario.MarioState is FireRightIdleState; bool expectedState = expectedMario.MarioState is FireRightIdleState; Vector2 testLocation = testMario.VectorCoordinates; Vector2 expectedLocation = expectedMario.VectorCoordinates; Assert.AreEqual(testState, expectedState); Assert.AreEqual(testLocation, expectedLocation); }