Game Controller Property Delta Engine Documentation

Namespace: Blocks
Assembly: Blocks (in Blocks.exe) Version: 1.1.1.0 (1.1.1)
Syntax

public Controller Controller { get; }

Property Value

Type: Controller
Remarks

Tests: Blocks.Tests.GameTests
Examples

13 unit tests call Blocks.Game.Controller
[Test, CloseAfterFirstFrame]
public void CursorLeftMovesBlockLeft()
{
    game.StartGame();
    InitializeBlocks(game.Controller, content);
    mockKeyboard.SetKeyboardState(Key.CursorLeft, State.Pressing);
    AdvanceTimeAndUpdateEntities(0.01f);
    if (IsMockResolver)
    //ncrunch: no coverage start 
        return; 
    Assert.AreEqual(4, game.Controller.FallingBlock.Left);
    //ncrunch: no coverage end
}
[Test, CloseAfterFirstFrame]
public void HoldingCursorLeftEventuallyMovesBlockLeftTwice()
{
    game.StartGame();
    InitializeBlocks(game.Controller, content);
    mockKeyboard.SetKeyboardState(Key.CursorLeft, State.Pressing);
    AdvanceTimeAndUpdateEntities(0.01f);
    if (IsMockResolver)
    //ncrunch: no coverage start 
        return; 
    Assert.AreEqual(4, game.Controller.FallingBlock.Left);
    AdvanceTimeAndUpdateEntities(0.02f);
    Assert.AreEqual(3, game.Controller.FallingBlock.Left);
    //ncrunch: no coverage end
}
[Test, CloseAfterFirstFrame]
public void CursorRightMovesBlockRight()
{
    game.StartGame();
    InitializeBlocks(game.Controller, content);
    mockKeyboard.SetKeyboardState(Key.CursorRight, State.Pressing);
    AdvanceTimeAndUpdateEntities(0.01f);
    if (IsMockResolver)
    //ncrunch: no coverage start 
        return; 
    Assert.AreEqual(8, game.Controller.FallingBlock.Left);
    //ncrunch: no coverage end
}
See Also