public void Ball_TestChargeOnBrickHit() { PointF origin = new PointF(80, 220); ChargedBall b = new ChargedBall(origin); b.moveVector = new SizeF(0, -1.0f); b.Update(); //Check if it goes through bricks. Assert.AreEqual(new SizeF(0, -1.0f), b.moveVector); b = new ChargedBall(new PointF(160, 220)); b.moveVector = new SizeF(0, -1.0f); b.chargeLevel = 1; b.Update(); b.Update(); Assert.AreEqual(new SizeF(0, 1.0f), b.moveVector); //Check if it has changed back to regular after losing its last charge Assert.AreEqual(typeof(RegularBall), GameManager.player.ball.GetType()); }
public void Ball_TestRechargeOnWallHit() { RectangleF gf = GameManager.gameField; PointF pos = new PointF(gf.Left, gf.Top / 2); SizeF move = new SizeF(-1.0f, 0f); ChargedBall b = new ChargedBall(pos); b.chargeLevel = 1; b.moveVector = move; b.Update(); b.Update(); //Check if the ball regains it's charges after hitting a wall. Assert.AreEqual(3, b.chargeLevel); }