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); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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); }
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 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); }
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); }
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); }