Controller MoveBlockRightIfPossible Method Delta Engine Documentation

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

public void MoveBlockRightIfPossible()
Remarks

Tests: Blocks.Tests.ControllerTests
Examples

3 unit tests call Blocks.Controller.MoveBlockRightIfPossible
[Test, CloseAfterFirstFrame]
public void CantMoveRightAtRightWall()
{
    Assert.IsFalse(sounds.BlockCouldNotMove.IsAnyInstancePlaying);
    controller.FallingBlock = new Block(displayMode, content, new Vector2D(11, 1));
    controller.MoveBlockRightIfPossible();
    Assert.AreEqual(11, controller.FallingBlock.Left);
    Assert.IsTrue(sounds.BlockCouldNotMove.IsAnyInstancePlaying);
}
[Test, CloseAfterFirstFrame]
public void CanMoveRightElsewhere()
{
    Assert.IsFalse(sounds.BlockMoved.IsAnyInstancePlaying);
    controller.FallingBlock = new Block(displayMode, content, new Vector2D(3, 1));
    controller.MoveBlockRightIfPossible();
    Assert.IsTrue(sounds.BlockMoved.IsAnyInstancePlaying);
    Assert.AreEqual(4, 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