GamePadTests TestGamePadButtonPress Method Delta Engine Documentation

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

public void TestGamePadButtonPress()
Examples

[Test, CloseAfterFirstFrame]
public void TestGamePadButtonPress()
{
    bool isPressed = false;
    new Command(() => isPressed = true).Add(new GamePadButtonTrigger(GamePadButton.A,
        State.Pressed));
    Assert.IsFalse(isPressed);
    var mockGamePad = Resolve<GamePad>() as MockGamePad;
    if (mockGamePad == null)
        return; //ncrunch: no coverage
    mockGamePad.SetGamePadState(GamePadButton.A, State.Pressed);
    AdvanceTimeAndUpdateEntities();
    Assert.IsTrue(isPressed);
    Assert.IsTrue(mockGamePad.IsAvailable);
}
See Also