Simulate pressing the mouse modifier key(s) (Alt, Shift and Control).
Press simulates pressing the specified keys.
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | When keys contains a value that is not Alt, Shift or Control. |
The following example performs a "shift drag" and verifies that two objects are selected.
[TestFixture] public class ATest : NUnitFormTest { // Gets the Form used for testing. public override Type FormType { get {return typeof(MyTestForm);} } [Test] public void Selecting() { ControlTester myControl = new ControlTester("myControl", CurrentForm); using (MouseController mouse = myControl.MouseController()) { mouse.Drag (10,10, 20,20); AssertEquals (1, myControl.Properties.SelectedObjects.Count); mouse.Press(Keys.Shift); mouse.Drag(100,100, 200,200); mouse.Release(Keys.Shift); AssertEquals (2, myControl.Properties.SelectedObjects.Count); } }
MouseController Class | NUnit.Extensions.Forms Namespace | MouseController.Press Overload List