Controller MoveBlockLeftIfPossible Method Delta Engine Documentation

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

public void MoveBlockLeftIfPossible()
Remarks

Tests: Blocks.Tests.ControllerTests
Examples

3 unit tests call Blocks.Controller.MoveBlockLeftIfPossible
[Test, CloseAfterFirstFrame]
public void CantMoveLeftAtLeftWall()
{
    Assert.IsFalse(sounds.BlockCouldNotMove.IsAnyInstancePlaying);
    controller.FallingBlock = new Block(displayMode, content, new Vector2D(0, 1));
    controller.MoveBlockLeftIfPossible();
    Assert.IsTrue(sounds.BlockCouldNotMove.IsAnyInstancePlaying);
    Assert.AreEqual(0, controller.FallingBlock.Left);
}
[Test, CloseAfterFirstFrame]
public void CanMoveLeftElsewhere()
{
    Assert.IsFalse(sounds.BlockMoved.IsAnyInstancePlaying);
    controller.FallingBlock = new Block(displayMode, content, new Vector2D(3, 1));
    controller.MoveBlockLeftIfPossible();
    Assert.IsTrue(sounds.BlockMoved.IsAnyInstancePlaying);
    Assert.AreEqual(2, controller.FallingBlock.Left);
}
[Test, CloseAfterFirstFrame]
public void CurrentBlockBeingNullWillNotCrashMovement()
{
    controller.FallingBlock = null;
    Assert.DoesNotThrow(controller.MoveBlockLeftIfPossible);
    Assert.DoesNotThrow(controller.MoveBlockRightIfPossible);
    Assert.DoesNotThrow(controller.RotateBlockAntiClockwiseIfPossible);
}
See Also