KeyTriggerTests CreateFromAttributes 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 CreateFromAttributes()
Examples

    [Test, CloseAfterFirstFrame]
    public void CreateFromAttributes()
    {
        var trigger = new KeyTrigger(new Dictionary<string, string>
            {
                { "Key", "Z" },
                { "State", " Pressed" }
            });
        Assert.AreEqual(Key.Z, trigger.Key);
        Assert.AreEqual(State.Pressed, trigger.State);
        Assert.Throws<KeyTrigger.CannotCreateKeyTriggerWithoutKey>(
            () => new KeyTrigger(new Dictionary<string, string>()));
    }

    [Test]
    public void UseMoveDirectlyCommandToMoveCircleAround()
    {
        var circle = new Ellipse(Vector2D.Half, 0.25f, 0.25f, Color.Orange);
        new Command(Command.MoveDirectly, position =>
            circle.DrawArea = circle.DrawArea.Move(position / 24.0f)); //ncrunch: no coverage
    }

    [Test]
    public void ZoomCircleWithPageUpPageDown()
    {
        var circle = new Ellipse(Vector2D.Half, 0.25f, 0.25f, Color.Orange);
        new Command(Command.Zoom, zoom =>
            circle.DrawArea = circle.DrawArea.Increase(new Size(zoom / 24.0f))); //ncrunch: no coverage
    }
}
See Also