BallTests BallShouldFollowPaddle Method Delta Engine Documentation

Namespace: Breakout.Tests
Assembly: Breakout.Tests (in Breakout.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void BallShouldFollowPaddle()
Examples

[Test, CloseAfterFirstFrame]
public void BallShouldFollowPaddle()
{
    if (!IsMockResolver)
        return; //ncrunch: no coverage 
    var ball = Resolve<Ball>();
    var paddle = Resolve<Paddle>();
    Assert.AreEqual(0.5f, ball.Position.X);
    Assert.AreEqual(ball.Position.X, paddle.Position.X);
    Resolve<MockKeyboard>().SetKeyboardState(Key.CursorLeft, State.Pressed);
    AdvanceTimeAndUpdateEntities(0.1f);
    Assert.AreNotEqual(0.5f, ball.Position.X);
    Assert.AreEqual(ball.Position.X, paddle.Position.X);
}
See Also