public void MultiSelectCopyAndPaste() { DebugProject.OpenProject(@"Python.VS.TestData\DebuggerProject.sln"); var app = new VisualStudioApp(VsIdeTestHostContext.Dte); app.OpenSolutionExplorer(); var window = app.SolutionExplorerTreeView; var folderNode = window.FindItem("Solution 'DebuggerProject' (1 project)", "DebuggerProject", "BreakAllTest.py"); folderNode.SetFocus(); Keyboard.Press(Key.LeftShift); Keyboard.PressAndRelease(Key.Down); Keyboard.PressAndRelease(Key.Down); Keyboard.Release(Key.LeftShift); Keyboard.ControlC(); var projectNode = window.FindItem("Solution 'DebuggerProject' (1 project)", "DebuggerProject"); projectNode.SetFocus(); Keyboard.ControlV(); Assert.AreNotEqual(null, window.WaitForItem("Solution 'DebuggerProject' (1 project)", "DebuggerProject", "BreakAllTest - Copy.py")); Assert.AreNotEqual(null, window.WaitForItem("Solution 'DebuggerProject' (1 project)", "DebuggerProject", "BreakpointTest - Copy.py")); Assert.AreNotEqual(null, window.WaitForItem("Solution 'DebuggerProject' (1 project)", "DebuggerProject", "BreakpointTest2 - Copy.py")); }
public static void PressAndRelease(Key key, params Key[] modifier) { for (int i = 0; i < modifier.Length; i++) { Keyboard.Press(modifier[i]); } Keyboard.Press(key); Keyboard.Release(key); for (int i = modifier.Length - 1; i >= 0; i--) { Keyboard.Release(modifier[i]); } }