Example #1
0
        private static void AutoIndentTest(IVisualStudioInstance solution, string typedText, string expectedText)
        {
            var doc = solution.OpenItem("AutoIndent", "server.js");

            doc.MoveCaret(1, 1);
            doc.Invoke(() => doc.TextView.Caret.EnsureVisible());
            doc.SetFocus();

            Keyboard.Type(typedText);

            string actual = null;

            for (int i = 0; i < 100; i++)
            {
                actual = doc.TextView.TextBuffer.CurrentSnapshot.GetText();

                if (expectedText == actual)
                {
                    break;
                }
                System.Threading.Thread.Sleep(100);
            }
            Assert.AreEqual(expectedText, actual);

            VSTestContext.DTE.ActiveWindow.Close(vsSaveChanges.vsSaveChangesNo);
        }
Example #2
0
        private static IEditor TestOneTabSnippet(IVisualStudioInstance vs, Snippet snippet)
        {
            Console.WriteLine("Testing: {0}", snippet.Shortcut);
            var editor = vs.OpenItem("SnippetsTest", "app.py");

            editor.MoveCaret(1, 1);
            editor.Invoke(() => editor.TextView.Caret.EnsureVisible());

            return(VerifySnippet(snippet, "pass", editor));
        }
Example #3
0
        private static IEditor TestOneTabSnippet(IVisualStudioInstance solution, Snippet snippet)
        {
            Console.WriteLine("Testing: {0}", snippet.Shortcut);
            var app = solution.OpenItem("SnippetsTest", "app.py");

            app.MoveCaret(1, 1);
            app.Invoke(() => app.TextView.Caret.EnsureVisible());
            app.SetFocus();

            return(VerifySnippet(snippet, "pass", app));
        }
Example #4
0
        private static IEditor TestOneTabSnippet(IVisualStudioInstance solution, Snippet snippet)
        {
            Console.WriteLine("Testing: {0}", snippet.Shortcut);
            var server = solution.OpenItem("SnippetsTest", "server.js");

            server.MoveCaret(1, 1);
            server.Invoke(() => server.TextView.Caret.EnsureVisible());
            server.SetFocus();

            return(VerifySnippet(snippet, "", server));
        }
Example #5
0
        private static IEditor TestOneSurroundWithSnippet(IVisualStudioInstance vs, Snippet snippet, string body = "42", string file = "nonempty.py")
        {
            Console.WriteLine("Testing: {0}", snippet.Shortcut);
            var editor = vs.OpenItem("SnippetsTest", file);

            editor.Select(1, 1, editor.Text.Length);
            editor.Invoke(() => editor.TextView.Caret.EnsureVisible());

            vs.ExecuteCommand("Edit.SurroundWith");
            return(VerifySnippet(snippet, body, editor));
        }
Example #6
0
        private static IEditor TestOneSurroundWithSnippet(IVisualStudioInstance solution, Snippet snippet, string body = "42", string file = "nonempty.py")
        {
            Console.WriteLine("Testing: {0}", snippet.Shortcut);
            var app = solution.OpenItem("SnippetsTest", file);

            app.Select(1, 1, app.Text.Length);
            app.Invoke(() => app.TextView.Caret.EnsureVisible());
            app.SetFocus();

            solution.ExecuteCommand("Edit.SurroundWith");
            return(VerifySnippet(snippet, body, app));
        }
Example #7
0
        private static IEditor TestOneInsertSnippetMoveCaret(IVisualStudioInstance vs, Snippet snippet, string category, string body = "42", string file = "nonempty.py", int line = 1)
        {
            Console.WriteLine("Testing: {0}", snippet.Shortcut);
            var editor = vs.OpenItem("SnippetsTest", file);

            editor.MoveCaret(line, 1);
            editor.Invoke(() => editor.TextView.Caret.EnsureVisible());

            vs.ExecuteCommand("Edit.InsertSnippet");
            Keyboard.Type(category + "\t");

            return(VerifySnippet(snippet, body, editor));
        }
        /// <summary>
        /// Moves one or more items in solution explorer using the keyboard to cut and paste.
        /// </summary>
        /// <param name="destination"></param>
        /// <param name="source"></param>
        private static void MoveByKeyboard(IVisualStudioInstance vs, ITreeNode destination, params ITreeNode[] source)
        {
            AutomationWrapper.Select(source.First());
            for (int i = 1; i < source.Length; i++)
            {
                AutomationWrapper.AddToSelection(source[i]);
            }

            vs.ControlX();

            AutomationWrapper.Select(destination);
            vs.ControlV();
        }
Example #9
0
        private static IEditor TestOneInsertSnippet(IVisualStudioInstance solution, Snippet snippet, string category, string body = "nonempty", string file = "nonempty.js")
        {
            Console.WriteLine("Testing: {0}", snippet.Shortcut);
            var server = solution.OpenItem("SnippetsTest", file);

            server.Select(1, 1, server.Text.Length);
            server.Invoke(() => server.TextView.Caret.EnsureVisible());
            server.SetFocus();

            solution.ExecuteCommand("Edit.InsertSnippet");
            Keyboard.Type(category + "\t");

            return(VerifySnippet(snippet, body, server));
        }
Example #10
0
        /// <summary>
        /// Moves one or more items in solution explorer using the keyboard to cut and paste.
        /// </summary>
        /// <param name="destination"></param>
        /// <param name="source"></param>
        private static void MoveByKeyboard(IVisualStudioInstance vs, ITreeNode destination, params ITreeNode[] source)
        {
            AutomationWrapper.Select(source.First());
            for (int i = 1; i < source.Length; i++)
            {
                AutomationWrapper.AddToSelection(source[i]);
            }

            vs.ControlX();

            AutomationWrapper.Select(destination);
            vs.ControlV();
            vs.MaybeCheckMessageBox(TestUtilities.MessageBoxButton.Ok, "One or more files will be");
        }
Example #11
0
        /// <summary>
        /// Moves one or more items in solution explorer using the keyboard to cut and paste.
        /// </summary>
        /// <param name="destination"></param>
        /// <param name="source"></param>
        private static void MoveByKeyboard(IVisualStudioInstance vs, ITreeNode destination, params ITreeNode[] source) {
            AutomationWrapper.Select(source.First());
            for (int i = 1; i < source.Length; i++) {
                AutomationWrapper.AddToSelection(source[i]);
            }

            vs.ControlX();

            AutomationWrapper.Select(destination);
            vs.ControlV();
        }
Example #12
0
 /// <summary>
 /// Moves one or more items in solution explorer to the destination using the mouse.
 /// </summary>
 internal static void CopyByMouse(IVisualStudioInstance vs, ITreeNode destination, params ITreeNode[] source) {
     destination.DragOntoThis(Key.LeftCtrl, source);
 }
Example #13
0
 /// <summary>
 /// Moves one or more items in solution explorer to the destination using the mouse.
 /// </summary>
 private static void MoveByMouse(IVisualStudioInstance vs, ITreeNode destination, params ITreeNode[] source) {
     destination.DragOntoThis(Key.LeftShift, source);
 }
Example #14
0
        private static IEditor TestOneSurroundWithSnippet(IVisualStudioInstance solution, Snippet snippet, string body = "42", string file = "nonempty.py") {
            Console.WriteLine("Testing: {0}", snippet.Shortcut);
            var app = solution.OpenItem("SnippetsTest", file);
            app.Select(1, 1, app.Text.Length);
            app.Invoke(() => app.TextView.Caret.EnsureVisible());
            app.SetFocus();

            solution.ExecuteCommand("Edit.SurroundWith");
            return VerifySnippet(snippet, body, app);
        }
Example #15
0
        private static IEditor TestOneTabSnippet(IVisualStudioInstance solution, Snippet snippet) {
            Console.WriteLine("Testing: {0}", snippet.Shortcut);
            var app = solution.OpenItem("SnippetsTest", "app.py");
            app.MoveCaret(1, 1);
            app.Invoke(() => app.TextView.Caret.EnsureVisible());
            app.SetFocus();

            return VerifySnippet(snippet, "pass", app);
        }
Example #16
0
        private static IEditor TestOneInsertSnippetMoveCaret(IVisualStudioInstance solution, Snippet snippet, string category, string body = "42", string file = "nonempty.py", int line = 1) {
            Console.WriteLine("Testing: {0}", snippet.Shortcut);
            var app = solution.OpenItem("SnippetsTest", file);
            app.MoveCaret(line, 1);
            app.Invoke(() => app.TextView.Caret.EnsureVisible());
            app.SetFocus();

            solution.ExecuteCommand("Edit.InsertSnippet");
            Keyboard.Type(category + "\t");

            return VerifySnippet(snippet, body, app);
        }
Example #17
0
        private static void AutoIndentTest(IVisualStudioInstance solution, string typedText, string expectedText) {
            var doc = solution.OpenItem("AutoIndent", "server.js");
            doc.MoveCaret(1, 1);
            doc.Invoke(() => doc.TextView.Caret.EnsureVisible());
            doc.SetFocus();

            Keyboard.Type(typedText);

            string actual = null;
            for (int i = 0; i < 100; i++) {
                actual = doc.TextView.TextBuffer.CurrentSnapshot.GetText();

                if (expectedText == actual) {
                    break;
                }
                System.Threading.Thread.Sleep(100);
            }
            Assert.AreEqual(expectedText, actual);

            VSTestContext.DTE.ActiveWindow.Close(vsSaveChanges.vsSaveChangesNo);
        }
Example #18
0
 /// <summary>
 /// Moves one or more items in solution explorer to the destination using the mouse.
 /// </summary>
 private static void MoveByMouse(IVisualStudioInstance vs, ITreeNode destination, params ITreeNode[] source)
 {
     destination.DragOntoThis(Key.LeftShift, source);
     vs.MaybeCheckMessageBox(TestUtilities.MessageBoxButton.Ok, "One or more files will be");
 }
Example #19
0
 /// <summary>
 /// Moves or copies (taking the default behavior) one or more items in solution explorer to 
 /// the destination using the mouse.
 /// </summary>
 private static void DragAndDrop(IVisualStudioInstance vs, ITreeNode destination, params ITreeNode[] source) {
     destination.DragOntoThis(source);
 }
        private static IEditor TestOneSurroundWithSnippet(IVisualStudioInstance solution, Snippet snippet, string category, string body = "nonempty", string file = "nonempty.js") {
            Console.WriteLine("Testing: {0}", snippet.Shortcut);
            var server = solution.OpenItem("SnippetsTest", file);
            server.Select(1, 1, server.Text.Length);
            server.Invoke(() => server.TextView.Caret.EnsureVisible());
            server.SetFocus();

            solution.ExecuteCommand("Edit.SurroundWith");
            Keyboard.Type(category + "\t");

            return VerifySnippet(snippet, body, server, insertViaMenu: true);
        }
        private static IEditor TestOneTabSnippet(IVisualStudioInstance solution, Snippet snippet) {
            Console.WriteLine("Testing: {0}", snippet.Shortcut);
            var server = solution.OpenItem("SnippetsTest", "server.js");
            server.MoveCaret(1, 1);
            server.Invoke(() => server.TextView.Caret.EnsureVisible());
            server.SetFocus();

            return VerifySnippet(snippet, "", server);
        }
 /// <summary>
 /// Moves one or more items in solution explorer to the destination using the mouse.
 /// </summary>
 private static void MoveByMouse(IVisualStudioInstance vs, ITreeNode destination, params ITreeNode[] source)
 {
     destination.DragOntoThis(Key.LeftShift, source);
 }