public void CheckCollisionTest() { GameObjectsManager gameObjectsManager = new GameObjectsManager(new Spaceship(), new Random()); SmallRocket rocket = new SmallRocket(new Vector2(5, 400), gameObjectsManager); gameObjectsManager.AddObject(rocket); gameObjectsManager.Update(new GameTime()); int hp = gameObjectsManager.CheckCollisions(); Assert.IsFalse(hp < 0); SmallRocket rocket2 = new SmallRocket(new Vector2(5, 50), gameObjectsManager); gameObjectsManager.AddObject(rocket2); gameObjectsManager.Update(new GameTime()); hp = gameObjectsManager.CheckCollisions(); Assert.IsTrue(hp < 0); }
public void LiftObjectsTest() { Spaceship spaceship = new Spaceship(); spaceship.X = 49; spaceship.Width = 200; GameObjectsManager manager = new GameObjectsManager(new Spaceship(), new Random()); manager.AddRandomObject(); manager.LiftObjects(spaceship); manager.Update(new GameTime()); PrivateObject privateManager = new PrivateObject(manager); List<LiftObject> liftObjects = (List<LiftObject>)privateManager.GetField("liftObjects"); Assert.IsTrue(liftObjects[0].Position.Y < 500); }