KeyboardTests TestSpaceKeyPress 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 TestSpaceKeyPress()
Examples

[Test, CloseAfterFirstFrame]
public void TestSpaceKeyPress()
{
    bool isSpacePressed = false;
    new Command(() => isSpacePressed = true).Add(new KeyTrigger(Key.Space, State.Pressed));
    Assert.IsFalse(isSpacePressed);
    if (mockKeyboard == null)
        return; //ncrunch: no coverage
    mockKeyboard.SetKeyboardState(Key.Space, State.Pressed);
    AdvanceTimeAndUpdateEntities();
    Assert.IsTrue(isSpacePressed);
    Assert.IsTrue(mockKeyboard.IsAvailable);
}
See Also