public VisualStudioInstance(SolutionFile solution)
        {
            _solution = solution;
            _app      = new VisualStudioApp();
            Project   = _app.OpenProject(solution.Filename);

            ThreadHelper.Generic.Invoke(Keyboard.Reset);
            _solutionExplorer = _app.OpenSolutionExplorer();
            SelectSolutionNode();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Selects the solution node using the mouse.
        ///
        /// This is used to reset the state of the mouse before a test as some
        /// tests can cause the mouse to be left in an odd state - the mouse up
        /// event is delivered to solution explorer, but selecting items later
        /// doesn't work because the mouse is left in an odd state.  If you
        /// make this method a nop and try and run all of the tests you'll
        /// see the bad behavior.
        /// </summary>
        public void SelectSolutionNode()
        {
            // May need to reopen Solution Explorer so we can find a clickable
            // point.
            _solutionExplorer = _app.OpenSolutionExplorer();
            var item = SolutionExplorer.WaitForItem(SolutionNodeText);

            SolutionExplorer.CenterInView(item);
            Mouse.MoveTo(item.GetClickablePoint());
            Mouse.Click(MouseButton.Left);
        }
Ejemplo n.º 3
0
        public VisualStudioInstance(SolutionFile solution)
        {
            _solution = solution;
            _app      = new VisualStudioApp();
            Project   = _app.OpenProject(solution.Filename);

            ThreadHelper.JoinableTaskFactory.Run(async() => {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
                Keyboard.Reset();
            });

            _solutionExplorer = _app.OpenSolutionExplorer();
            SelectSolutionNode();
        }