Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Input.Tests MouseMovementTriggerTests
Namespace: DeltaEngine.Input.Tests
Assembly: DeltaEngine.Input.Tests (in DeltaEngine.Input.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The MouseMovementTriggerTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
MouseMovementTriggerTests | Initializes a new instance of the MouseMovementTriggerTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
Create | ||
CreateFromAttributes | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
MoveMouseToUpdatePositionOfCircle | ||
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
UpdatePosition |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test] public void MoveMouseToUpdatePositionOfCircle() { var ellipse = new Ellipse(new Rectangle(-0.1f, -0.1f, 0.1f, 0.1f), Color.Red); new Command(pos => ellipse.Center = pos).Add(new MouseMovementTrigger()); }
[Test, CloseAfterFirstFrame] public void UpdatePosition() { Vector2D position = Vector2D.Zero; new Command(pos => position = pos).Add(new MouseMovementTrigger()); Assert.AreEqual(Vector2D.Zero, position); var mockMouse = Resolve<Mouse>() as MockMouse; if (mockMouse == null) return; //ncrunch: no coverage mockMouse.SetNativePosition(new Vector2D(0.4f, 0.6f)); AdvanceTimeAndUpdateEntities(); Assert.AreEqual(new Vector2D(0.4f, 0.6f), position); }
[Test, CloseAfterFirstFrame] public void Create() { var trigger = new MouseMovementTrigger(); Assert.AreEqual(Vector2D.Zero, trigger.Movement); Assert.IsFalse(trigger.IsPauseable); }
[Test, CloseAfterFirstFrame] public void CreateFromAttributes() { var trigger = new MouseMovementTrigger(new Dictionary<string, string>()); Assert.AreEqual(Vector2D.Zero, trigger.Movement); Assert.Throws<MouseMovementTrigger.MouseMovementTriggerHasNoParameters>( () => new MouseMovementTrigger(new Dictionary<string, string> { { "a", "b" } })); }
See Also