From fd9b37f01bd9eb2ba449147c19a20d846fdbebca Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Fri, 31 Mar 2017 15:47:20 -0700 Subject: [PATCH] refactoring tests to not use extension methods --- .../IntegrationTests/AbstractEditorTest.cs | 26 +- .../AbstractIntegrationTest.cs | 16 +- .../AbstractInteractiveWindowTest.cs | 13 +- .../CSharp/CSharpAddMissingReference.cs | 43 ++- .../CSharp/CSharpAutomaticBraceCompletion.cs | 163 ++++++------ .../IntegrationTests/CSharp/CSharpBuild.cs | 15 +- .../CSharp/CSharpChangeSignatureDialog.cs | 42 +-- .../CSharp/CSharpClassification.cs | 116 ++++---- .../CSharp/CSharpCodeActions.cs | 10 +- .../CSharp/CSharpEncapsulateField.cs | 20 +- .../CSharp/CSharpErrorListCommon.cs | 52 ++-- .../CSharp/CSharpFindReferences.cs | 26 +- .../CSharp/CSharpGenerateTypeDialog.cs | 22 +- .../CSharp/CSharpGoToDefinition.cs | 50 ++-- .../CSharp/CSharpIntelliSense.cs | 157 ++++++----- .../CSharp/CSharpInteractive.cs | 47 ++-- .../CSharp/CSharpInteractiveAsyncOutput.cs | 31 ++- .../CSharp/CSharpInteractiveBoxSelection.cs | 172 ++++++------ .../CSharp/CSharpInteractiveCommands.cs | 150 ++++++----- .../CSharp/CSharpInteractiveDirectives.cs | 183 +++++++------ .../CSharp/CSharpInteractiveFormsAndWpf.cs | 11 +- .../CSharp/CSharpNavigateTo.cs | 28 +- .../CSharp/CSharpQuickInfo.cs | 18 +- .../CSharp/CSharpReplClassification.cs | 58 ++-- .../CSharp/CSharpReplIdeFeatures.cs | 204 +++++++------- .../CSharp/CSharpReplIntellisense.cs | 61 ++--- .../CSharp/CSharpSendToInteractive.cs | 251 +++++++++--------- .../CSharp/CSharpSignatureHelp.cs | 37 ++- .../CSharp/CSharpSquigglesCommon.cs | 9 +- .../IntegrationTests/CSharp/CSharpWinForms.cs | 121 ++++----- .../Extensions/CommonExtensions.Verifiers.cs | 122 --------- .../Extensions/CommonExtensions.cs | 41 --- .../Extensions/EditorExtensions.Verifiers.cs | 211 --------------- .../Extensions/EditorExtensions.cs | 70 ----- .../ErrorListExtensions.Verifiers.cs | 17 -- .../Extensions/ErrorListExtensions.cs | 45 ---- .../InteractiveExtensions.Verifiers.cs | 59 ---- .../Extensions/InteractiveExtensions.cs | 47 ---- .../Extensions/SetOptionsExtensions.cs | 47 ---- .../SolutionExplorerExtensions.Verifiers.cs | 30 --- .../Extensions/SolutionExplorerExtensions.cs | 76 ------ .../VisualBasic/BasicAddMissingReference.cs | 49 ++-- .../BasicAutomaticBraceCompletion.cs | 133 +++++----- .../VisualBasic/BasicBuild.cs | 10 +- .../VisualBasic/BasicChangeSignatureDialog.cs | 31 +-- .../VisualBasic/BasicClassification.cs | 65 +++-- .../VisualBasic/BasicEncapsulateField.cs | 20 +- .../VisualBasic/BasicErrorListCommon.cs | 50 ++-- .../VisualBasic/BasicFindReferences.cs | 20 +- .../BasicGenerateConstructorDialog.cs | 46 ++-- ...BasicGenerateEqualsAndGetHashCodeDialog.cs | 22 +- .../VisualBasic/BasicGenerateTypeDialog.cs | 37 +-- .../VisualBasic/BasicGoToDefinition.cs | 38 ++- .../VisualBasic/BasicIntelliSense.cs | 159 ++++++----- .../VisualBasic/BasicNavigateTo.cs | 26 +- .../VisualBasic/BasicQuickInfo.cs | 9 +- .../VisualBasic/BasicSignatureHelp.cs | 69 +++-- .../VisualBasic/BasicSquigglesCommon.cs | 9 +- .../VisualBasic/BasicWinForms.cs | 164 ++++++------ .../VisualStudioIntegrationTests.csproj | 12 +- .../Workspace/WorkspaceBase.cs | 72 +++-- .../Workspace/WorkspacesDesktop.cs | 6 +- .../Workspace/WorkspacesNetCore.cs | 17 +- .../OutOfProcess/Editor_OutOfProc.Verifier.cs | 199 ++++++++++++++ .../OutOfProcess/Editor_OutOfProc.cs | 37 +++ .../ErrorList_OutOfProc.Verifier.cs | 28 ++ .../OutOfProcess/ErrorList_OutOfProc.cs | 34 ++- .../FindReferencesWindow_OutOfProc.cs | 2 +- .../GenerateTypeDialog_OutOfProc.cs | 4 +- .../InteractiveWindow_OutOfProc.Verifier.cs | 58 ++++ .../InteractiveWindow_OutOfProc.cs | 16 +- .../OutOfProcess/OutOfProcComponent.cs | 10 +- .../SolutionExplorer_OutOfProc.Verifier.cs | 39 +++ .../SolutionExplorer_OutOfProc.cs | 92 ++++--- .../TextViewWindow_OutOfProc.Verifier.cs | 129 +++++++++ .../OutOfProcess/TextViewWindow_OutOfProc.cs | 30 ++- .../VisualStudioWorkspace_OutOfProc.cs | 24 +- .../TestUtilities/VisualStudioInstance.cs | 14 +- ...isualStudioIntegrationTestUtilities.csproj | 5 + 79 files changed, 2225 insertions(+), 2477 deletions(-) delete mode 100644 src/VisualStudio/IntegrationTest/IntegrationTests/Extensions/CommonExtensions.Verifiers.cs delete mode 100644 src/VisualStudio/IntegrationTest/IntegrationTests/Extensions/CommonExtensions.cs delete mode 100644 src/VisualStudio/IntegrationTest/IntegrationTests/Extensions/EditorExtensions.Verifiers.cs delete mode 100644 src/VisualStudio/IntegrationTest/IntegrationTests/Extensions/EditorExtensions.cs delete mode 100644 src/VisualStudio/IntegrationTest/IntegrationTests/Extensions/ErrorListExtensions.Verifiers.cs delete mode 100644 src/VisualStudio/IntegrationTest/IntegrationTests/Extensions/ErrorListExtensions.cs delete mode 100644 src/VisualStudio/IntegrationTest/IntegrationTests/Extensions/InteractiveExtensions.Verifiers.cs delete mode 100644 src/VisualStudio/IntegrationTest/IntegrationTests/Extensions/InteractiveExtensions.cs delete mode 100644 src/VisualStudio/IntegrationTest/IntegrationTests/Extensions/SetOptionsExtensions.cs delete mode 100644 src/VisualStudio/IntegrationTest/IntegrationTests/Extensions/SolutionExplorerExtensions.Verifiers.cs delete mode 100644 src/VisualStudio/IntegrationTest/IntegrationTests/Extensions/SolutionExplorerExtensions.cs create mode 100644 src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/Editor_OutOfProc.Verifier.cs create mode 100644 src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/ErrorList_OutOfProc.Verifier.cs create mode 100644 src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/InteractiveWindow_OutOfProc.Verifier.cs create mode 100644 src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.Verifier.cs create mode 100644 src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/TextViewWindow_OutOfProc.Verifier.cs diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractEditorTest.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractEditorTest.cs index 02e08b1108e50..3451f944b77a9 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractEditorTest.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractEditorTest.cs @@ -3,19 +3,15 @@ using Microsoft.VisualStudio.IntegrationTest.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities.OutOfProcess; using Roslyn.Test.Utilities; -using Roslyn.VisualStudio.IntegrationTests.Extensions.SolutionExplorer; using ProjectUtils = Microsoft.VisualStudio.IntegrationTest.Utilities.Common.ProjectUtils; namespace Roslyn.VisualStudio.IntegrationTests { public abstract class AbstractEditorTest : AbstractIntegrationTest { - protected readonly Editor_OutOfProc Editor; - protected AbstractEditorTest(VisualStudioInstanceFactory instanceFactory) - : base(instanceFactory, visualStudio => visualStudio.Instance.Editor) + : base(instanceFactory) { - Editor = (Editor_OutOfProc)TextViewWindow; } protected AbstractEditorTest(VisualStudioInstanceFactory instanceFactory, string solutionName) @@ -27,19 +23,17 @@ protected AbstractEditorTest( VisualStudioInstanceFactory instanceFactory, string solutionName, string projectTemplate) - : base(instanceFactory, visualStudio => visualStudio.Instance.Editor) + : base(instanceFactory) { - this.CreateSolution(solutionName); - this.AddProject(projectTemplate, new ProjectUtils.Project(ProjectName), LanguageName); - - Editor = (Editor_OutOfProc)TextViewWindow; + VisualStudio.SolutionExplorer.CreateSolution(solutionName); + VisualStudio.SolutionExplorer.AddProject(new ProjectUtils.Project(ProjectName), projectTemplate, LanguageName); // Winforms and XAML do not open text files on creation // so these editor tasks will not work if that is the project template being used. if (projectTemplate != WellKnownProjectTemplates.WinFormsApplication && projectTemplate != WellKnownProjectTemplates.WpfApplication) { - VisualStudioWorkspaceOutOfProc.SetUseSuggestionMode(false); + VisualStudio.Workspace.SetUseSuggestionMode(false); ClearEditor(); } } @@ -53,17 +47,17 @@ protected void SetUpEditor(string markupCode) { MarkupTestFile.GetPosition(markupCode, out string code, out int caretPosition); - var originalValue = VisualStudioWorkspaceOutOfProc.IsPrettyListingOn(LanguageName); + var originalValue = VisualStudio.Workspace.IsPrettyListingOn(LanguageName); - VisualStudioWorkspaceOutOfProc.SetPrettyListing(LanguageName, false); + VisualStudio.Workspace.SetPrettyListing(LanguageName, false); try { - Editor.SetText(code); - Editor.MoveCaret(caretPosition); + VisualStudio.Editor.SetText(code); + VisualStudio.Editor.MoveCaret(caretPosition); } finally { - VisualStudioWorkspaceOutOfProc.SetPrettyListing(LanguageName, originalValue); + VisualStudio.Workspace.SetPrettyListing(LanguageName, originalValue); } } } diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractIntegrationTest.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractIntegrationTest.cs index 26ac6f90f2736..fb76c7582c04f 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractIntegrationTest.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractIntegrationTest.cs @@ -11,24 +11,22 @@ namespace Roslyn.VisualStudio.IntegrationTests [CaptureTestName] public abstract class AbstractIntegrationTest : IDisposable { - public readonly VisualStudioInstanceContext VisualStudio; - public readonly VisualStudioWorkspace_OutOfProc VisualStudioWorkspaceOutOfProc; - public readonly TextViewWindow_OutOfProc TextViewWindow; + public readonly VisualStudioInstance VisualStudio; protected readonly string ProjectName = "TestProj"; protected readonly string SolutionName = "TestSolution"; + private VisualStudioInstanceContext _visualStudioContext; + protected AbstractIntegrationTest( - VisualStudioInstanceFactory instanceFactory, - Func textViewWindowBuilder) + VisualStudioInstanceFactory instanceFactory) { - VisualStudio = instanceFactory.GetNewOrUsedInstance(SharedIntegrationHostFixture.RequiredPackageIds); - TextViewWindow = textViewWindowBuilder(VisualStudio); - VisualStudioWorkspaceOutOfProc = VisualStudio.Instance.VisualStudioWorkspace; + _visualStudioContext = instanceFactory.GetNewOrUsedInstance(SharedIntegrationHostFixture.RequiredPackageIds); + VisualStudio = _visualStudioContext.Instance; } public void Dispose() - => VisualStudio.Dispose(); + => _visualStudioContext.Dispose(); protected void Wait(double seconds) { diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractInteractiveWindowTest.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractInteractiveWindowTest.cs index 1d5a5ac9adab7..a5b4fab676d97 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractInteractiveWindowTest.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/AbstractInteractiveWindowTest.cs @@ -7,21 +7,18 @@ namespace Roslyn.VisualStudio.IntegrationTests { public abstract class AbstractInteractiveWindowTest : AbstractIntegrationTest { - internal readonly CSharpInteractiveWindow_OutOfProc InteractiveWindow; - protected AbstractInteractiveWindowTest(VisualStudioInstanceFactory instanceFactory) - : base(instanceFactory, visualStudio => visualStudio.Instance.CSharpInteractiveWindow) + : base(instanceFactory) { - InteractiveWindow = (CSharpInteractiveWindow_OutOfProc)TextViewWindow; ClearInteractiveWindow(); } protected void ClearInteractiveWindow() { - InteractiveWindow.Initialize(); - InteractiveWindow.ClearScreen(); - InteractiveWindow.ShowWindow(); - InteractiveWindow.Reset(); + VisualStudio.InteractiveWindow.Initialize(); + VisualStudio.InteractiveWindow.ClearScreen(); + VisualStudio.InteractiveWindow.ShowWindow(); + VisualStudio.InteractiveWindow.Reset(); } } } \ No newline at end of file diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpAddMissingReference.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpAddMissingReference.cs index 922bf6db342d2..cc4f2a2325782 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpAddMissingReference.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpAddMissingReference.cs @@ -4,9 +4,6 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities; -using Roslyn.VisualStudio.IntegrationTests.Extensions; -using Roslyn.VisualStudio.IntegrationTests.Extensions.Editor; -using Roslyn.VisualStudio.IntegrationTests.Extensions.SolutionExplorer; using Xunit; using ProjectUtils = Microsoft.VisualStudio.IntegrationTest.Utilities.Common.ProjectUtils; @@ -102,7 +99,7 @@ static void Main(string[] args) public CSharpAddMissingReference(VisualStudioInstanceFactory instanceFactory) : base(instanceFactory) { - VisualStudio.Instance.SolutionExplorer.CreateSolution("ReferenceErrors", solutionElement: XElement.Parse( + VisualStudio.SolutionExplorer.CreateSolution("ReferenceErrors", solutionElement: XElement.Parse( "" + $" " + " $$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("System.Action<", VirtualKey.Tab); + VisualStudio.Editor.Verify.CurrentLineText("System.Action<>$$", assertCaretPosition: true); SetUpEditor(@" class C { @@ -218,8 +217,8 @@ class C { $$ }"); - this.SendKeys("void GenericMethod<", VirtualKey.Tab); - this.VerifyCurrentLineText("void GenericMethod<>$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("void GenericMethod<", VirtualKey.Tab); + VisualStudio.Editor.Verify.CurrentLineText("void GenericMethod<>$$", assertCaretPosition: true); SetUpEditor(@" class C { @@ -227,24 +226,24 @@ class C { $$ }"); - this.SendKeys("delegate void Del<"); - this.VerifyCurrentLineText("delegate void Del<$$>", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("delegate void Del<"); + VisualStudio.Editor.Verify.CurrentLineText("delegate void Del<$$>", assertCaretPosition: true); SetUpEditor(@" //using directive $$ "); - this.SendKeys("using ActionOfT = System.Action<"); - this.VerifyCurrentLineText("using ActionOfT = System.Action<$$>", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("using ActionOfT = System.Action<"); + VisualStudio.Editor.Verify.CurrentLineText("using ActionOfT = System.Action<$$>", assertCaretPosition: true); SetUpEditor(@" //class $$ "); - this.SendKeys("class GenericClass<", '>'); - this.VerifyCurrentLineText("class GenericClass<>$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("class GenericClass<", '>'); + VisualStudio.Editor.Verify.CurrentLineText("class GenericClass<>$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] @@ -255,13 +254,13 @@ class C { $$ }"); - this.SendKeys("char c = '"); - this.VerifyCurrentLineText("char c = '$$'", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("char c = '"); + VisualStudio.Editor.Verify.CurrentLineText("char c = '$$'", assertCaretPosition: true); - this.SendKeys(VirtualKey.Delete, VirtualKey.Backspace); - this.SendKeys("'\u6666", "'"); + VisualStudio.Editor.SendKeys(VirtualKey.Delete, VirtualKey.Backspace); + VisualStudio.Editor.SendKeys("'\u6666", "'"); - this.VerifyCurrentLineText("char c = '\u6666'$$", assertCaretPosition: true); + VisualStudio.Editor.Verify.CurrentLineText("char c = '\u6666'$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] @@ -277,7 +276,7 @@ void M() } }"); - this.SendKeys( + VisualStudio.Editor.SendKeys( "var arr=new object[,]{{Foo(0", VirtualKey.Tab, VirtualKey.Tab, @@ -289,7 +288,7 @@ void M() VirtualKey.Tab, ';'); - this.VerifyCurrentLineText("var arr = new object[,] { { Foo(0) }, { Foo(Foo(\"hello\")) } };$$", assertCaretPosition: true); + VisualStudio.Editor.Verify.CurrentLineText("var arr = new object[,] { { Foo(0) }, { Foo(Foo(\"hello\")) } };$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] @@ -300,8 +299,8 @@ class C { // $$ }"); - this.SendKeys("{([\"'"); - this.VerifyCurrentLineText("// {([\"'$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("{([\"'"); + VisualStudio.Editor.Verify.CurrentLineText("// {([\"'$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] @@ -314,8 +313,8 @@ class C { */ }"); - this.SendKeys("{([\"'"); - this.VerifyCurrentLineText("{([\"'$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("{([\"'"); + VisualStudio.Editor.Verify.CurrentLineText("{([\"'$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] @@ -326,18 +325,18 @@ class C { $$ }"); - this.SendKeys("string s = \"{([<'"); - this.VerifyCurrentLineText("string s = \"{([<'\"$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("string s = \"{([<'"); + VisualStudio.Editor.Verify.CurrentLineText("string s = \"{([<'\"$$", assertCaretPosition: true); - this.SendKeys(VirtualKey.End, ';', VirtualKey.Enter); + VisualStudio.Editor.SendKeys(VirtualKey.End, ';', VirtualKey.Enter); - this.SendKeys("string y = @\"{([<'"); - this.VerifyCurrentLineText("string y = @\"{([<'\"$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("string y = @\"{([<'"); + VisualStudio.Editor.Verify.CurrentLineText("string y = @\"{([<'\"$$", assertCaretPosition: true); - this.SendKeys(VirtualKey.End, ';', VirtualKey.Enter); + VisualStudio.Editor.SendKeys(VirtualKey.End, ';', VirtualKey.Enter); - this.SendKeys("char ch = '{([<\""); - this.VerifyCurrentLineText("char ch = '{([<\"'$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("char ch = '{([<\""); + VisualStudio.Editor.Verify.CurrentLineText("char ch = '{([<\"'$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] @@ -347,11 +346,11 @@ public void Negative_NoCompletionInXmlDocComments() $$ class C { }"); - this.SendKeys( + VisualStudio.Editor.SendKeys( "///", "{([<\"'"); - this.VerifyCurrentLineText("/// {([<\"'$$", assertCaretPosition: true); + VisualStudio.Editor.Verify.CurrentLineText("/// {([<\"'$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] @@ -364,8 +363,8 @@ class C { #endif }"); - this.SendKeys("void Foo("); - this.VerifyCurrentLineText("void Foo($$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("void Foo("); + VisualStudio.Editor.Verify.CurrentLineText("void Foo($$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] @@ -377,8 +376,8 @@ public void Negative_NoCompletionAfterRegionPreprocesser() #endregion "); - this.SendKeys("{([<\"'"); - this.VerifyCurrentLineText("#region {([<\"'$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("{([<\"'"); + VisualStudio.Editor.Verify.CurrentLineText("#region {([<\"'$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] @@ -390,8 +389,8 @@ public void Negative_NoCompletionAfterEndregionPreprocesser() #endregion $$ "); - this.SendKeys("{([<\"'"); - this.VerifyCurrentLineText("#endregion {([<\"'$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("{([<\"'"); + VisualStudio.Editor.Verify.CurrentLineText("#endregion {([<\"'$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] @@ -401,8 +400,8 @@ public void Negative_NoCompletionAfterIfPreprocesser() #if $$ "); - this.SendKeys("{([<\"'"); - this.VerifyCurrentLineText("#if {([<\"'$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("{([<\"'"); + VisualStudio.Editor.Verify.CurrentLineText("#if {([<\"'$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] @@ -412,8 +411,8 @@ public void Negative_NoCompletionAfterPragmaPreprocesser() #pragma $$ "); - this.SendKeys("{([<\"'"); - this.VerifyCurrentLineText("#pragma {([<\"'$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("{([<\"'"); + VisualStudio.Editor.Verify.CurrentLineText("#pragma {([<\"'$$", assertCaretPosition: true); } [WorkItem(651954, "DevDiv")] @@ -432,8 +431,8 @@ class B : A } "); - this.SendKeys("override Foo("); - var actualText = Editor.GetText(); + VisualStudio.Editor.SendKeys("override Foo("); + var actualText = VisualStudio.Editor.GetText(); Assert.Contains(@" class B : A { @@ -460,8 +459,8 @@ void M() } "); - this.SendKeys("new Li(", VirtualKey.Tab); - this.VerifyCurrentLineText("List li = new List($$)", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("new Li(", VirtualKey.Tab); + VisualStudio.Editor.Verify.CurrentLineText("List li = new List($$)", assertCaretPosition: true); } [WorkItem(823958, "DevDiv")] @@ -478,8 +477,8 @@ void M() } "); - this.SendKeys("new int[]{"); - this.VerifyCurrentLineText("var x = new int[] {$$}", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("new int[]{"); + VisualStudio.Editor.Verify.CurrentLineText("var x = new int[] {$$}", assertCaretPosition: true); } [WorkItem(823958, "DevDiv")] @@ -496,8 +495,8 @@ void M() } "); - this.SendKeys("new {"); - this.VerifyCurrentLineText("var x = new {$$}", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("new {"); + VisualStudio.Editor.Verify.CurrentLineText("var x = new {$$}", assertCaretPosition: true); } [WorkItem(823958, "DevDiv")] @@ -508,13 +507,13 @@ public void AutoBraceCompleteFormatsBracePairInClassDeclarationAndAutoProperty() class $$ "); - this.SendKeys("C{"); - this.VerifyCurrentLineText("class C { $$}", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("C{"); + VisualStudio.Editor.Verify.CurrentLineText("class C { $$}", assertCaretPosition: true); - this.SendKeys( + VisualStudio.Editor.SendKeys( VirtualKey.Enter, "int Prop {"); - this.VerifyTextContains(@" + VisualStudio.Editor.Verify.TextContains(@" class C { int Prop { $$} diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpBuild.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpBuild.cs index e90ba07c35656..35a44579c38fd 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpBuild.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpBuild.cs @@ -6,6 +6,7 @@ using Microsoft.VisualStudio.IntegrationTest.Utilities; using Roslyn.Test.Utilities; using Xunit; +using ProjectUtils = Microsoft.VisualStudio.IntegrationTest.Utilities.Common.ProjectUtils; namespace Roslyn.VisualStudio.IntegrationTests.CSharp { @@ -13,10 +14,10 @@ namespace Roslyn.VisualStudio.IntegrationTests.CSharp public class CSharpBuild : AbstractIntegrationTest { public CSharpBuild(VisualStudioInstanceFactory instanceFactory) - : base(instanceFactory, _ => null) + : base(instanceFactory) { - VisualStudio.Instance.SolutionExplorer.CreateSolution(nameof(CSharpBuild)); - VisualStudio.Instance.SolutionExplorer.AddProject("TestProj", WellKnownProjectTemplates.ConsoleApplication, LanguageNames.CSharp); + VisualStudio.SolutionExplorer.CreateSolution(nameof(CSharpBuild)); + VisualStudio.SolutionExplorer.AddProject(new ProjectUtils.Project("TestProj"), WellKnownProjectTemplates.ConsoleApplication, LanguageNames.CSharp); } [Fact, Trait(Traits.Feature, Traits.Features.Build)] @@ -32,7 +33,7 @@ static void Main(string[] args) } }"; - VisualStudio.Instance.Editor.SetText(editorText); + VisualStudio.Editor.SetText(editorText); // TODO: Validate build works as expected } @@ -40,10 +41,10 @@ static void Main(string[] args) [Fact(Skip = "https://github.com/dotnet/roslyn/issues/18299"), Trait(Traits.Feature, Traits.Features.Build)] public void BuildWithCommandLine() { - VisualStudio.Instance.SolutionExplorer.SaveAll(); + VisualStudio.SolutionExplorer.SaveAll(); - var pathToDevenv = Path.Combine(VisualStudio.Instance.InstallationPath, @"Common7\IDE\devenv.exe"); - var pathToSolution = VisualStudio.Instance.SolutionExplorer.SolutionFileFullPath; + var pathToDevenv = Path.Combine(VisualStudio.InstallationPath, @"Common7\IDE\devenv.exe"); + var pathToSolution = VisualStudio.SolutionExplorer.SolutionFileFullPath; var logFileName = pathToSolution + ".log"; File.Delete(logFileName); diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpChangeSignatureDialog.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpChangeSignatureDialog.cs index c44ee0f000ce0..8e6f79ecb3ef0 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpChangeSignatureDialog.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpChangeSignatureDialog.cs @@ -4,8 +4,8 @@ using Microsoft.VisualStudio.IntegrationTest.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities.OutOfProcess; using Roslyn.Test.Utilities; -using Roslyn.VisualStudio.IntegrationTests.Extensions; using Xunit; +using ProjectUtils = Microsoft.VisualStudio.IntegrationTest.Utilities.Common.ProjectUtils; namespace Roslyn.VisualStudio.IntegrationTests.CSharp { @@ -14,7 +14,7 @@ public class CSharpChangeSignatureDialog : AbstractEditorTest { protected override string LanguageName => LanguageNames.CSharp; - private ChangeSignatureDialog_OutOfProc ChangeSignatureDialog => VisualStudio.Instance.ChangeSignatureDialog; + private ChangeSignatureDialog_OutOfProc ChangeSignatureDialog => VisualStudio.ChangeSignatureDialog; public CSharpChangeSignatureDialog(VisualStudioInstanceFactory instanceFactory) : base(instanceFactory, nameof(CSharpChangeSignatureDialog)) @@ -31,8 +31,8 @@ class C public void Method(int a, string b) { } }"); - this.InvokeCodeActionList(); - this.VerifyCodeAction("Change signature...", applyFix: false); + VisualStudio.Editor.InvokeCodeActionList(); + VisualStudio.Editor.Verify.CodeAction("Change signature...", applyFix: false); } [Fact, Trait(Traits.Feature, Traits.Features.ChangeSignature)] @@ -48,7 +48,7 @@ class C ChangeSignatureDialog.VerifyOpen(); ChangeSignatureDialog.ClickCancel(); ChangeSignatureDialog.VerifyClosed(); - var actuaText = Editor.GetText(); + var actuaText = VisualStudio.Editor.GetText(); Assert.Contains(@" class C { @@ -72,7 +72,7 @@ class C ChangeSignatureDialog.ClickDownButton(); ChangeSignatureDialog.ClickOK(); ChangeSignatureDialog.VerifyClosed(); - var actuaText = Editor.GetText(); + var actuaText = VisualStudio.Editor.GetText(); Assert.Contains(@" class C { @@ -107,7 +107,7 @@ void Test() ChangeSignatureDialog.ClickRemoveButton(); ChangeSignatureDialog.ClickOK(); ChangeSignatureDialog.VerifyClosed(); - var actuaText = Editor.GetText(); + var actuaText = VisualStudio.Editor.GetText(); Assert.Contains(@" class C { @@ -141,17 +141,19 @@ static void Main(string[] args) } }"); - - VisualStudio.Instance.SolutionExplorer.AddProject("VBProject", WellKnownProjectTemplates.ClassLibrary, LanguageNames.VisualBasic); - Editor.SetText(@" + var vbProject = new ProjectUtils.Project("VBProject"); + var vbProjectReference = new ProjectUtils.ProjectReference(vbProject.Name); + var project = new ProjectUtils.Project(ProjectName); + VisualStudio.SolutionExplorer.AddProject(vbProject, WellKnownProjectTemplates.ClassLibrary, LanguageNames.VisualBasic); + VisualStudio.Editor.SetText(@" Public Class VBClass Public Sub Method(x As Integer, y As String) End Sub End Class"); - VisualStudio.Instance.SolutionExplorer.SaveAll(); - VisualStudio.Instance.SolutionExplorer.AddProjectReference(fromProjectName: ProjectName, toProjectName: "VBProject"); - VisualStudio.Instance.SolutionExplorer.OpenFile(ProjectName, "Class1.cs"); + VisualStudio.SolutionExplorer.SaveAll(); + VisualStudio.SolutionExplorer.AddProjectReference(fromProjectName: project, toProjectName: vbProjectReference); + VisualStudio.SolutionExplorer.OpenFile(project, "Class1.cs"); ChangeSignatureDialog.Invoke(); ChangeSignatureDialog.VerifyOpen(); @@ -159,19 +161,19 @@ End Sub ChangeSignatureDialog.ClickUpButton(); ChangeSignatureDialog.ClickOK(); ChangeSignatureDialog.VerifyClosed(); - var actuaText = Editor.GetText(); + var actuaText = VisualStudio.Editor.GetText(); Assert.Contains(@"vb.Method(y: ""hello"", x: 1);", actuaText); - VisualStudio.Instance.SolutionExplorer.OpenFile("VBProject", "Class1.vb"); - actuaText = Editor.GetText(); + VisualStudio.SolutionExplorer.OpenFile(vbProject, "Class1.vb"); + actuaText = VisualStudio.Editor.GetText(); Assert.Contains(@"Public Sub Method(y As String, x As Integer)", actuaText); - Editor.Undo(); - actuaText = Editor.GetText(); + VisualStudio.Editor.Undo(); + actuaText = VisualStudio.Editor.GetText(); Assert.Contains(@"Public Sub Method(x As Integer, y As String)", actuaText); - VisualStudio.Instance.SolutionExplorer.OpenFile(ProjectName, "Class1.cs"); - actuaText = Editor.GetText(); + VisualStudio.SolutionExplorer.OpenFile(project, "Class1.cs"); + actuaText = VisualStudio.Editor.GetText(); Assert.Contains(@"vb.Method(2, ""world"");", actuaText); } } diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpClassification.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpClassification.cs index fa460f24a1db5..4c709d277fe89 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpClassification.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpClassification.cs @@ -3,8 +3,6 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities; -using Roslyn.VisualStudio.IntegrationTests.Extensions; -using Roslyn.VisualStudio.IntegrationTests.Extensions.Editor; using Xunit; namespace Roslyn.VisualStudio.IntegrationTests.CSharp @@ -22,7 +20,7 @@ public CSharpClassification(VisualStudioInstanceFactory instanceFactory) [Fact, Trait(Traits.Feature, Traits.Features.Classification)] public void VerifyColorOfSomeTokens() { - Editor.SetText(@"using System; + VisualStudio.Editor.SetText(@"using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 @@ -41,36 +39,36 @@ public static void Main(string[] args) } }"); - this.PlaceCaret("class"); - this.VerifyCurrentTokenType(tokenType: "keyword"); - this.PlaceCaret("{"); - this.VerifyCurrentTokenType(tokenType: "punctuation"); - this.PlaceCaret("Program"); - this.VerifyCurrentTokenType(tokenType: "class name"); - this.PlaceCaret("Main"); - this.VerifyCurrentTokenType(tokenType: "identifier"); - this.PlaceCaret("Hello"); - this.VerifyCurrentTokenType(tokenType: "string"); - this.PlaceCaret(" param; set => param = value; }"); + VisualStudio.Editor.Verify.TextContains("public static int? Param { get => param; set => param = value; }"); } [Fact, Trait(Traits.Feature, Traits.Features.EncapsulateField)] public void EncapsulateThroughLightbulbIncludingReferences() { SetUpEditor(TestSource); - this.InvokeCodeActionList(); - this.VerifyCodeAction("Encapsulate field: 'param' (and use property)", applyFix: true, blockUntilComplete: true); - this.VerifyTextContains(@" + VisualStudio.Editor.InvokeCodeActionList(); + VisualStudio.Editor.Verify.CodeAction("Encapsulate field: 'param' (and use property)", applyFix: true, blockUntilComplete: true); + VisualStudio.Editor.Verify.TextContains(@" namespace myNamespace { class Program @@ -76,9 +74,9 @@ static void Main(string[] args) public void EncapsulateThroughLightbulbDefinitionsOnly() { SetUpEditor(TestSource); - this.InvokeCodeActionList(); - this.VerifyCodeAction("Encapsulate field: 'param' (but still use field)", applyFix: true, blockUntilComplete: true); - this.VerifyTextContains(@" + VisualStudio.Editor.InvokeCodeActionList(); + VisualStudio.Editor.Verify.CodeAction("Encapsulate field: 'param' (but still use field)", applyFix: true, blockUntilComplete: true); + VisualStudio.Editor.Verify.TextContains(@" namespace myNamespace { class Program diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpErrorListCommon.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpErrorListCommon.cs index c99242e121d9e..033220b2422e6 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpErrorListCommon.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpErrorListCommon.cs @@ -4,10 +4,6 @@ using Microsoft.VisualStudio.IntegrationTest.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities.Common; using Microsoft.VisualStudio.IntegrationTest.Utilities.Input; -using Roslyn.VisualStudio.IntegrationTests.Extensions; -using Roslyn.VisualStudio.IntegrationTests.Extensions.Editor; -using Roslyn.VisualStudio.IntegrationTests.Extensions.ErrorList; -using Roslyn.VisualStudio.IntegrationTests.Extensions.SolutionExplorer; using Xunit; namespace Roslyn.VisualStudio.IntegrationTests.CSharp @@ -23,7 +19,7 @@ public CSharpErrorListCommon(VisualStudioInstanceFactory instanceFactor, string public virtual void ErrorList() { - Editor.SetText(@" + VisualStudio.Editor.SetText(@" class C { void M(P p) @@ -36,7 +32,7 @@ static void Main(string[] args) } } "); - this.ShowErrorList(); + VisualStudio.ErrorList.ShowErrorList(); var expectedContents = new[] { new ErrorListItem( severity: "Error", @@ -53,19 +49,19 @@ static void Main(string[] args) line: 6, column: 24) }; - var actualContents = this.GetErrorListContents(); + var actualContents = VisualStudio.ErrorList.GetErrorListContents(); Assert.Equal(expectedContents, actualContents); - this.NavigateToErrorListItem(0); - this.VerifyCaretPosition(25); - this.BuildSolution(waitForBuildToFinish: true); - this.ShowErrorList(); - actualContents = this.GetErrorListContents(); + VisualStudio.ErrorList.NavigateToErrorListItem(0); + VisualStudio.Editor.Verify.CaretPosition(25); + VisualStudio.SolutionExplorer.BuildSolution(waitForBuildToFinish: true); + VisualStudio.ErrorList.ShowErrorList(); + actualContents = VisualStudio.ErrorList.GetErrorListContents(); Assert.Equal(expectedContents, actualContents); } public virtual void ErrorLevelWarning() { - Editor.SetText(@" + VisualStudio.Editor.SetText(@" class C { static void Main(string[] args) @@ -74,7 +70,7 @@ static void Main(string[] args) } } "); - this.ShowErrorList(); + VisualStudio.ErrorList.ShowErrorList(); var expectedContents = new[] { new ErrorListItem( severity: "Warning", @@ -84,13 +80,13 @@ static void Main(string[] args) line: 6, column: 13) }; - var actualContents = this.GetErrorListContents(); + var actualContents = VisualStudio.ErrorList.GetErrorListContents(); Assert.Equal(expectedContents, actualContents); } public virtual void ErrorsDuringMethodBodyEditing() { - Editor.SetText(@" + VisualStudio.Editor.SetText(@" using System; class Program2 @@ -101,15 +97,15 @@ static void Main(string[] args) } } "); - this.ShowErrorList(); + VisualStudio.ErrorList.ShowErrorList(); var expectedContents = new ErrorListItem[] { }; - var actualContents = this.GetErrorListContents(); + var actualContents = VisualStudio.ErrorList.GetErrorListContents(); Assert.Equal(expectedContents, actualContents); - Editor.Activate(); - this.PlaceCaret("a = aa", charsOffset: -1); - this.SendKeys("a"); - this.ShowErrorList(); + VisualStudio.Editor.Activate(); + VisualStudio.Editor.PlaceCaret("a = aa", charsOffset: -1); + VisualStudio.Editor.SendKeys("a"); + VisualStudio.ErrorList.ShowErrorList(); expectedContents = new[] { new ErrorListItem( severity: "Error", @@ -119,15 +115,15 @@ static void Main(string[] args) line: 8, column: 29) }; - actualContents = this.GetErrorListContents(); + actualContents = VisualStudio.ErrorList.GetErrorListContents(); Assert.Equal(expectedContents, actualContents); - Editor.Activate(); - this.PlaceCaret("aa = aa", charsOffset: -1); - this.SendKeys(VirtualKey.Delete); - this.ShowErrorList(); + VisualStudio.Editor.Activate(); + VisualStudio.Editor.PlaceCaret("aa = aa", charsOffset: -1); + VisualStudio.Editor.SendKeys(VirtualKey.Delete); + VisualStudio.ErrorList.ShowErrorList(); expectedContents = new ErrorListItem[] { }; - actualContents = this.GetErrorListContents(); + actualContents = VisualStudio.ErrorList.GetErrorListContents(); Assert.Equal(expectedContents, actualContents); } } diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpFindReferences.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpFindReferences.cs index 0fd890e665b0c..b21b73136bb6e 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpFindReferences.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpFindReferences.cs @@ -6,8 +6,8 @@ using Microsoft.VisualStudio.IntegrationTest.Utilities.Common; using Microsoft.VisualStudio.IntegrationTest.Utilities.Input; using Roslyn.Test.Utilities; -using Roslyn.VisualStudio.IntegrationTests.Extensions.Editor; using Xunit; +using ProjectUtils = Microsoft.VisualStudio.IntegrationTest.Utilities.Common.ProjectUtils; namespace Roslyn.VisualStudio.IntegrationTests.CSharp { @@ -30,9 +30,9 @@ class Program { }$$ "); - - VisualStudio.Instance.SolutionExplorer.AddFile(ProjectName, "File2.cs"); - VisualStudio.Instance.SolutionExplorer.OpenFile(ProjectName, "File2.cs"); + var project = new ProjectUtils.Project(ProjectName); ; + VisualStudio.SolutionExplorer.AddFile(project, "File2.cs"); + VisualStudio.SolutionExplorer.OpenFile(project, "File2.cs"); SetUpEditor(@" class SomeOtherClass @@ -44,12 +44,12 @@ void M() } "); - this.SendKeys(Shift(VirtualKey.F12)); + VisualStudio.Editor.SendKeys(Shift(VirtualKey.F12)); const string programReferencesCaption = "'Program' references"; - var results = VisualStudio.Instance.FindReferencesWindow.GetContents(programReferencesCaption); + var results = VisualStudio.FindReferencesWindow.GetContents(programReferencesCaption); - var activeWindowCaption = VisualStudio.Instance.Shell.GetActiveWindowCaption(); + var activeWindowCaption = VisualStudio.Shell.GetActiveWindowCaption(); Assert.Equal(expected: programReferencesCaption, actual: activeWindowCaption); Assert.Collection( @@ -85,12 +85,12 @@ static void Main() } "); - this.SendKeys(Shift(VirtualKey.F12)); + VisualStudio.Editor.SendKeys(Shift(VirtualKey.F12)); const string localReferencesCaption = "'local' references"; - var results = VisualStudio.Instance.FindReferencesWindow.GetContents(localReferencesCaption); + var results = VisualStudio.FindReferencesWindow.GetContents(localReferencesCaption); - var activeWindowCaption = VisualStudio.Instance.Shell.GetActiveWindowCaption(); + var activeWindowCaption = VisualStudio.Shell.GetActiveWindowCaption(); Assert.Equal(expected: localReferencesCaption, actual: activeWindowCaption); Assert.Collection( @@ -125,12 +125,12 @@ static void Main() } "); - this.SendKeys(Shift(VirtualKey.F12)); + VisualStudio.Editor.SendKeys(Shift(VirtualKey.F12)); const string findReferencesCaption = "'\"1\"' references"; - var results = VisualStudio.Instance.FindReferencesWindow.GetContents(findReferencesCaption); + var results = VisualStudio.FindReferencesWindow.GetContents(findReferencesCaption); - var activeWindowCaption = VisualStudio.Instance.Shell.GetActiveWindowCaption(); + var activeWindowCaption = VisualStudio.Shell.GetActiveWindowCaption(); Assert.Equal(expected: findReferencesCaption, actual: activeWindowCaption); Assert.Collection( diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpGenerateTypeDialog.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpGenerateTypeDialog.cs index c698724ca0342..540e16f66a5ad 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpGenerateTypeDialog.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpGenerateTypeDialog.cs @@ -4,8 +4,8 @@ using Microsoft.VisualStudio.IntegrationTest.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities.OutOfProcess; using Roslyn.Test.Utilities; -using Roslyn.VisualStudio.IntegrationTests.Extensions; using Xunit; +using ProjectUtils = Microsoft.VisualStudio.IntegrationTest.Utilities.Common.ProjectUtils; namespace Roslyn.VisualStudio.IntegrationTests.CSharp { @@ -14,7 +14,7 @@ public class CSharpGenerateTypeDialog : AbstractEditorTest { protected override string LanguageName => LanguageNames.CSharp; - private GenerateTypeDialog_OutOfProc GenerateTypeDialog => VisualStudio.Instance.GenerateTypeDialog; + private GenerateTypeDialog_OutOfProc GenerateTypeDialog => VisualStudio.GenerateTypeDialog; public CSharpGenerateTypeDialog(VisualStudioInstanceFactory instanceFactory) : base(instanceFactory, nameof(CSharpGenerateTypeDialog)) @@ -33,7 +33,7 @@ void Method() } "); - this.VerifyCodeAction("Generate new type...", + VisualStudio.Editor.Verify.CodeAction("Generate new type...", applyFix: true, blockUntilComplete: false); @@ -45,9 +45,11 @@ void Method() [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)] public void CSharpToBasic() { - VisualStudio.Instance.SolutionExplorer.AddProject("VBProj", WellKnownProjectTemplates.ClassLibrary, LanguageNames.VisualBasic); + var vbProj = new ProjectUtils.Project("VBProj"); + VisualStudio.SolutionExplorer.AddProject(vbProj, WellKnownProjectTemplates.ClassLibrary, LanguageNames.VisualBasic); - VisualStudio.Instance.SolutionExplorer.OpenFile(ProjectName, "Class1.cs"); + var project = new ProjectUtils.Project(ProjectName); + VisualStudio.SolutionExplorer.OpenFile(project, "Class1.cs"); SetUpEditor(@"class C { @@ -58,7 +60,7 @@ void Method() } "); - this.VerifyCodeAction("Generate new type...", + VisualStudio.Editor.Verify.CodeAction("Generate new type...", applyFix: true, blockUntilComplete: false); @@ -70,14 +72,14 @@ void Method() GenerateTypeDialog.ClickOK(); GenerateTypeDialog.VerifyClosed(); - VisualStudio.Instance.SolutionExplorer.OpenFile("VBProj", "GenerateTypeTest.vb"); - var actualText = Editor.GetText(); + VisualStudio.SolutionExplorer.OpenFile(vbProj, "GenerateTypeTest.vb"); + var actualText = VisualStudio.Editor.GetText(); Assert.Contains(@"Public Interface A End Interface ", actualText); - VisualStudio.Instance.SolutionExplorer.OpenFile(ProjectName, "Class1.cs"); - actualText = Editor.GetText(); + VisualStudio.SolutionExplorer.OpenFile(project, "Class1.cs"); + actualText = VisualStudio.Editor.GetText(); Assert.Contains(@"using VBProj; class C diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpGoToDefinition.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpGoToDefinition.cs index 32778e2621dc6..4cadbd7a64580 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpGoToDefinition.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpGoToDefinition.cs @@ -5,8 +5,6 @@ using Microsoft.VisualStudio.IntegrationTest.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities.Common; using Roslyn.Test.Utilities; -using Roslyn.VisualStudio.IntegrationTests.Extensions.Editor; -using Roslyn.VisualStudio.IntegrationTests.Extensions.SolutionExplorer; using Xunit; using ProjectUtils = Microsoft.VisualStudio.IntegrationTest.Utilities.Common.ProjectUtils; @@ -26,47 +24,47 @@ public CSharpGoToDefinition(VisualStudioInstanceFactory instanceFactory) public void GoToClassDeclaration() { var project = new ProjectUtils.Project(ProjectName); - this.AddFile("FileDef.cs", project); - this.OpenFile("FileDef.cs", project); - Editor.SetText( + VisualStudio.SolutionExplorer.AddFile(project, "FileDef.cs"); + VisualStudio.SolutionExplorer.OpenFile( project, "FileDef.cs"); + VisualStudio.Editor.SetText( @"class SomeClass { }"); - this.AddFile("FileConsumer.cs", project); - this.OpenFile("FileConsumer.cs", project); - Editor.SetText( + VisualStudio.SolutionExplorer.AddFile(project,"FileConsumer.cs"); + VisualStudio.SolutionExplorer.OpenFile(project, "FileConsumer.cs"); + VisualStudio.Editor.SetText( @"class SomeOtherClass { SomeClass sc; }"); - this.PlaceCaret("SomeClass"); - Editor.GoToDefinition(); - this.VerifyTextContains(@"class SomeClass$$", assertCaretPosition: true); - Assert.False(VisualStudio.Instance.Shell.IsActiveTabProvisional()); + VisualStudio.Editor.PlaceCaret("SomeClass"); + VisualStudio.Editor.GoToDefinition(); + VisualStudio.Editor.Verify.TextContains(@"class SomeClass$$", assertCaretPosition: true); + Assert.False(VisualStudio.Shell.IsActiveTabProvisional()); } [Fact, Trait(Traits.Feature, Traits.Features.GoToDefinition)] public void GoToDefinitionOpensProvisionalTabIfDocumentNotAlreadyOpen() { var project = new ProjectUtils.Project(ProjectName); - this.AddFile("FileDef.cs", project); - this.OpenFile("FileDef.cs", project); - Editor.SetText( + VisualStudio.SolutionExplorer.AddFile(project, "FileDef.cs"); + VisualStudio.SolutionExplorer.OpenFile(project, "FileDef.cs"); + VisualStudio.Editor.SetText( @"class SomeClass { }"); - this.CloseFile("FileDef.cs", project); - this.AddFile("FileConsumer.cs", project); - this.OpenFile("FileConsumer.cs", project); - Editor.SetText( + VisualStudio.SolutionExplorer.CloseFile(project, "FileDef.cs", saveFile: true); + VisualStudio.SolutionExplorer.AddFile(project, "FileConsumer.cs"); + VisualStudio.SolutionExplorer.OpenFile(project, "FileConsumer.cs"); + VisualStudio.Editor.SetText( @"class SomeOtherClass { SomeClass sc; }"); - this.PlaceCaret("SomeClass"); - Editor.GoToDefinition(); - this.VerifyTextContains(@"class SomeClass$$", assertCaretPosition: true); - Assert.True(VisualStudio.Instance.Shell.IsActiveTabProvisional()); + VisualStudio.Editor.PlaceCaret("SomeClass"); + VisualStudio.Editor.GoToDefinition(); + VisualStudio.Editor.Verify.TextContains(@"class SomeClass$$", assertCaretPosition: true); + Assert.True(VisualStudio.Shell.IsActiveTabProvisional()); } [Fact, Trait(Traits.Feature, Traits.Features.GoToDefinition)] @@ -77,12 +75,12 @@ public void GoToDefinitionWithMultipleResults() partial class PartialClass { int i = 0; }"); - Editor.GoToDefinition(); + VisualStudio.Editor.GoToDefinition(); const string programReferencesCaption = "'PartialClass' declarations"; - var results = VisualStudio.Instance.FindReferencesWindow.GetContents(programReferencesCaption); + var results = VisualStudio.FindReferencesWindow.GetContents(programReferencesCaption); - var activeWindowCaption = VisualStudio.Instance.Shell.GetActiveWindowCaption(); + var activeWindowCaption = VisualStudio.Shell.GetActiveWindowCaption(); Assert.Equal(expected: programReferencesCaption, actual: activeWindowCaption); Assert.Collection( diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpIntelliSense.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpIntelliSense.cs index b7eba5463bdf2..8aef7d81b52d2 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpIntelliSense.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpIntelliSense.cs @@ -4,9 +4,6 @@ using Microsoft.VisualStudio.IntegrationTest.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities.Input; using Roslyn.Test.Utilities; -using Roslyn.VisualStudio.IntegrationTests.Extensions; -using Roslyn.VisualStudio.IntegrationTests.Extensions.Editor; -using Roslyn.VisualStudio.IntegrationTests.Extensions.Options; using Xunit; namespace Roslyn.VisualStudio.IntegrationTests.CSharp @@ -26,11 +23,11 @@ public void AtNamespaceLevel() { SetUpEditor(@"$$"); - this.SendKeys("usi"); - this.VerifyCompletionItemExists("using"); + VisualStudio.Editor.SendKeys("usi"); + VisualStudio.Editor.Verify.CompletionItemsExist("using"); - this.SendKeys(VirtualKey.Tab); - this.VerifyCurrentLineText("using$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys(VirtualKey.Tab); + VisualStudio.Editor.Verify.CurrentLineText("using$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] @@ -42,18 +39,18 @@ class C $$ }"); - this.SendKeys("pub"); - this.VerifyCompletionItemExists("public"); + VisualStudio.Editor.SendKeys("pub"); + VisualStudio.Editor.Verify.CompletionItemsExist("public"); - this.SendKeys(' '); - this.VerifyCurrentLineText("public $$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys(' '); + VisualStudio.Editor.Verify.CurrentLineText("public $$", assertCaretPosition: true); - this.SendKeys('t'); - this.VerifyCompletionItemExists("T"); + VisualStudio.Editor.SendKeys('t'); + VisualStudio.Editor.Verify.CompletionItemsExist("T"); - this.SendKeys(' '); - this.SendKeys("Foo() { }"); - this.VerifyTextContains(@" + VisualStudio.Editor.SendKeys(' '); + VisualStudio.Editor.SendKeys("Foo() { }"); + VisualStudio.Editor.Verify.TextContains(@" class C { public T Foo() { }$$ @@ -79,68 +76,68 @@ public static void Search(string s){ } public static void Navigate(int i){ } }"); - this.SendKeys('.'); - this.VerifyCompletionItemExists("Search", "Navigate"); + VisualStudio.Editor.SendKeys('.'); + VisualStudio.Editor.Verify.CompletionItemsExist("Search", "Navigate"); - this.SendKeys('S', VirtualKey.Tab); - this.VerifyCurrentLineText("NavigateTo.Search$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys('S', VirtualKey.Tab); + VisualStudio.Editor.Verify.CurrentLineText("NavigateTo.Search$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] public void CtrlAltSpace() { - this.SetUseSuggestionMode(false); - - this.SendKeys("nam Foo", VirtualKey.Enter); - this.SendKeys('{', VirtualKey.Enter, '}', VirtualKey.Up, VirtualKey.Enter); - this.SendKeys("pu cla Program", VirtualKey.Enter); - this.SendKeys('{', VirtualKey.Enter, '}', VirtualKey.Up, VirtualKey.Enter); - this.SendKeys("pub stati voi Main(string[] args)", VirtualKey.Enter); - this.SendKeys('{', VirtualKey.Enter, '}', VirtualKey.Up, VirtualKey.Enter); - this.SendKeys("System.Console.writeline();"); - this.VerifyCurrentLineText("System.Console.WriteLine();$$", assertCaretPosition: true); - this.SendKeys(VirtualKey.Home, Shift(VirtualKey.End), VirtualKey.Delete); - - this.ExecuteCommand(WellKnownCommandNames.Edit_ToggleCompletionMode); - - this.SendKeys("System.Console.writeline();"); - this.VerifyCurrentLineText("System.Console.writeline();$$", assertCaretPosition: true); + VisualStudio.Workspace.SetUseSuggestionMode(false); + + VisualStudio.Editor.SendKeys("nam Foo", VirtualKey.Enter); + VisualStudio.Editor.SendKeys('{', VirtualKey.Enter, '}', VirtualKey.Up, VirtualKey.Enter); + VisualStudio.Editor.SendKeys("pu cla Program", VirtualKey.Enter); + VisualStudio.Editor.SendKeys('{', VirtualKey.Enter, '}', VirtualKey.Up, VirtualKey.Enter); + VisualStudio.Editor.SendKeys("pub stati voi Main(string[] args)", VirtualKey.Enter); + VisualStudio.Editor.SendKeys('{', VirtualKey.Enter, '}', VirtualKey.Up, VirtualKey.Enter); + VisualStudio.Editor.SendKeys("System.Console.writeline();"); + VisualStudio.Editor.Verify.CurrentLineText("System.Console.WriteLine();$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys(VirtualKey.Home, Shift(VirtualKey.End), VirtualKey.Delete); + + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_ToggleCompletionMode); + + VisualStudio.Editor.SendKeys("System.Console.writeline();"); + VisualStudio.Editor.Verify.CurrentLineText("System.Console.writeline();$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] public void CtrlAltSpaceOption() { - this.SetUseSuggestionMode(false); + VisualStudio.Workspace.SetUseSuggestionMode(false); - this.SendKeys("nam Foo"); - this.VerifyCurrentLineText("namespace Foo$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("nam Foo"); + VisualStudio.Editor.Verify.CurrentLineText("namespace Foo$$", assertCaretPosition: true); ClearEditor(); - this.SetUseSuggestionMode(true); + VisualStudio.Workspace.SetUseSuggestionMode(true); - this.SendKeys("nam Foo"); - this.VerifyCurrentLineText("nam Foo$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("nam Foo"); + VisualStudio.Editor.Verify.CurrentLineText("nam Foo$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] public void CtrlSpace() { SetUpEditor("class c { void M() {$$ } }"); - this.SendKeys(Ctrl(VirtualKey.Space)); - this.VerifyCompletionItemExists("System"); + VisualStudio.Editor.SendKeys(Ctrl(VirtualKey.Space)); + VisualStudio.Editor.Verify.CompletionItemsExist("System"); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] public void NavigatingWithDownKey() { SetUpEditor("class c { void M() {$$ } }"); - this.SendKeys('c'); - this.VerifyCurrentCompletionItem("c"); - this.VerifyCompletionItemExists("c"); + VisualStudio.Editor.SendKeys('c'); + VisualStudio.Editor.Verify.CurrentCompletionItem("c"); + VisualStudio.Editor.Verify.CompletionItemsExist("c"); - this.SendKeys(VirtualKey.Down); - this.VerifyCurrentCompletionItem("char"); - this.VerifyCompletionItemExists("char"); + VisualStudio.Editor.SendKeys(VirtualKey.Down); + VisualStudio.Editor.Verify.CurrentCompletionItem("char"); + VisualStudio.Editor.Verify.CompletionItemsExist("char"); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] @@ -156,11 +153,11 @@ void Main(string[] args) } }"); - this.SendKeys("", assertCaretPosition: true); + VisualStudio.Editor.SendKeys(VirtualKey.Enter); + VisualStudio.Editor.Verify.CurrentLineText("///", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] @@ -171,16 +168,16 @@ public void XmlTagCompletion() class C { } "); - this.SendKeys(""); - this.VerifyCurrentLineText("/// $$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys(""); + VisualStudio.Editor.Verify.CurrentLineText("/// $$", assertCaretPosition: true); SetUpEditor(@" /// $$ class C { } "); - this.SendKeys("$$", assertCaretPosition: true); + VisualStudio.Editor.SendKeys("$$", assertCaretPosition: true); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] @@ -195,12 +192,12 @@ void Main(string[] args) } }"); - this.SetUseSuggestionMode(false); + VisualStudio.Workspace.SetUseSuggestionMode(false); - this.SendKeys("Mai("); + VisualStudio.Editor.SendKeys("Mai("); - this.VerifyCurrentSignature("void Class1.Main(string[] args)"); - this.VerifyCurrentParameter("args", ""); + VisualStudio.Editor.Verify.CurrentSignature("void Class1.Main(string[] args)"); + VisualStudio.Editor.Verify.CurrentParameter("args", ""); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] @@ -213,18 +210,18 @@ void Main(string[] args) $$ }"); - this.SetUseSuggestionMode(false); + VisualStudio.Workspace.SetUseSuggestionMode(false); - this.SendKeys( + VisualStudio.Editor.SendKeys( '{', VirtualKey.Enter, " "); - this.InvokeCompletionList(); + VisualStudio.Editor.InvokeCompletionList(); - this.SendKeys('}'); + VisualStudio.Editor.SendKeys('}'); - this.VerifyTextContains(@" + VisualStudio.Editor.Verify.TextContains(@" class Class1 { void Main(string[] args) @@ -246,13 +243,13 @@ void Main(string[] args) } }"); - this.SetUseSuggestionMode(false); + VisualStudio.Workspace.SetUseSuggestionMode(false); - this.SendKeys( + VisualStudio.Editor.SendKeys( 'M', Shift(VirtualKey.Enter)); - this.VerifyTextContains(@" + VisualStudio.Editor.Verify.TextContains(@" class Class1 { void Main(string[] args) @@ -272,11 +269,11 @@ class Class1 $$ }"); - this.SetUseSuggestionMode(false); + VisualStudio.Workspace.SetUseSuggestionMode(false); - this.SendKeys("int P { g{"); + VisualStudio.Editor.SendKeys("int P { g{"); - this.VerifyTextContains(@" + VisualStudio.Editor.Verify.TextContains(@" class Class1 { int P { get { $$} } @@ -297,13 +294,13 @@ static void Main(string[] args) } }"); - this.SendKeys( + VisualStudio.Editor.SendKeys( VirtualKey.Delete, "aaa", VirtualKey.Tab); - var actualText = Editor.GetText(); + var actualText = VisualStudio.Editor.GetText(); Assert.Contains("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", actualText); - Assert.True(Editor.IsCaretOnScreen()); + Assert.True(VisualStudio.Editor.IsCaretOnScreen()); } [Fact, Trait(Traits.Feature, Traits.Features.Completion)] @@ -311,11 +308,11 @@ public void DismissOnSelect() { SetUpEditor(@"$$"); - this.SendKeys(Ctrl(VirtualKey.Space)); - Assert.Equal(true, Editor.IsCompletionActive()); + VisualStudio.Editor.SendKeys(Ctrl(VirtualKey.Space)); + Assert.Equal(true, VisualStudio.Editor.IsCompletionActive()); - this.SendKeys(Ctrl(VirtualKey.A)); - Assert.Equal(false, Editor.IsCompletionActive()); + VisualStudio.Editor.SendKeys(Ctrl(VirtualKey.A)); + Assert.Equal(false, VisualStudio.Editor.IsCompletionActive()); } } } \ No newline at end of file diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractive.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractive.cs index efbdd33934ea8..a7da7a931fe31 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractive.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractive.cs @@ -3,7 +3,6 @@ using System; using System.Threading.Tasks; using Microsoft.VisualStudio.IntegrationTest.Utilities; -using Roslyn.VisualStudio.IntegrationTests.Extensions.Interactive; using Xunit; namespace Roslyn.VisualStudio.IntegrationTests.CSharp @@ -19,56 +18,56 @@ public CSharpInteractive(VisualStudioInstanceFactory instanceFactory) [Fact] public void BclMathCall() { - this.SubmitText("Math.Sin(1)"); - this.WaitForLastReplOutput("0.8414709848078965"); + VisualStudio.InteractiveWindow.SubmitText("Math.Sin(1)"); + VisualStudio.InteractiveWindow.WaitForLastReplOutput("0.8414709848078965"); } [Fact] public void BclConsoleCall() { - this.SubmitText(@"Console.WriteLine(""Hello, World!"");"); - this.WaitForLastReplOutput("Hello, World!"); + VisualStudio.InteractiveWindow.SubmitText(@"Console.WriteLine(""Hello, World!"");"); + VisualStudio.InteractiveWindow.WaitForLastReplOutput("Hello, World!"); } [Fact] public void ForStatement() { - this.SubmitText("for (int i = 0; i < 10; i++) Console.WriteLine(i * i);"); - this.WaitForLastReplOutputContains($"{81}"); + VisualStudio.InteractiveWindow.SubmitText("for (int i = 0; i < 10; i++) Console.WriteLine(i * i);"); + VisualStudio.InteractiveWindow.WaitForLastReplOutputContains($"{81}"); } [Fact] public void ForEachStatement() { - this.SubmitText(@"foreach (var f in System.IO.Directory.GetFiles(@""c:\windows"")) Console.WriteLine($""{f}"".ToLower());"); - this.WaitForLastReplOutputContains(@"c:\windows\win.ini"); + VisualStudio.InteractiveWindow.SubmitText(@"foreach (var f in System.IO.Directory.GetFiles(@""c:\windows"")) Console.WriteLine($""{f}"".ToLower());"); + VisualStudio.InteractiveWindow.WaitForLastReplOutputContains(@"c:\windows\win.ini"); } [Fact] public void TopLevelMethod() { - this.SubmitText(@"int Fac(int x) + VisualStudio.InteractiveWindow.SubmitText(@"int Fac(int x) { return x < 1 ? 1 : x * Fac(x - 1); } Fac(4)"); - this.WaitForLastReplOutput($"{24}"); + VisualStudio.InteractiveWindow.WaitForLastReplOutput($"{24}"); } [Fact] public async Task WpfInteractionAsync() { - this.SubmitText(@"#r ""WindowsBase"" + VisualStudio.InteractiveWindow.SubmitText(@"#r ""WindowsBase"" #r ""PresentationCore"" #r ""PresentationFramework"" #r ""System.Xaml"""); - this.SubmitText(@"using System.Windows; + VisualStudio.InteractiveWindow.SubmitText(@"using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Imaging;"); - this.SubmitText(@"var w = new Window(); + VisualStudio.InteractiveWindow.SubmitText(@"var w = new Window(); w.Title = ""Hello World""; w.FontFamily = new FontFamily(""Calibri""); w.FontSize = 24; @@ -79,7 +78,7 @@ public async Task WpfInteractionAsync() var testValue = Guid.NewGuid(); - this.SubmitText($@"var b = new Button(); + VisualStudio.InteractiveWindow.SubmitText($@"var b = new Button(); b.Content = ""{testValue}""; b.Margin = new Thickness(40); b.Click += (sender, e) => Console.WriteLine(""Hello, World!""); @@ -90,24 +89,24 @@ public async Task WpfInteractionAsync() await AutomationElementHelper.ClickAutomationElementAsync(testValue.ToString(), recursive: true); - this.WaitForLastReplOutput("Hello, World!"); - this.SubmitText("b = null; w.Close(); w = null;"); + VisualStudio.InteractiveWindow.WaitForLastReplOutput("Hello, World!"); + VisualStudio.InteractiveWindow.SubmitText("b = null; w.Close(); w = null;"); } [Fact] public void TypingHelpDirectiveWorks() { - VisualStudioWorkspaceOutOfProc.SetUseSuggestionMode(true); - InteractiveWindow.ShowWindow(waitForPrompt: true); + VisualStudio.Workspace.SetUseSuggestionMode(true); + VisualStudio.InteractiveWindow.ShowWindow(waitForPrompt: true); - // Directly type #help, rather than sending it through this.SubmitText. We want to actually test + // Directly type #help, rather than sending it through VisualStudio.InteractiveWindow.SubmitText. We want to actually test // that completion doesn't interfere and there aren't problems with the content-type switching. - VisualStudio.Instance.SendKeys.Send("#help"); + VisualStudio.SendKeys.Send("#help"); - Assert.EndsWith("#help", InteractiveWindow.GetReplText()); + Assert.EndsWith("#help", VisualStudio.InteractiveWindow.GetReplText()); - VisualStudio.Instance.SendKeys.Send("\n"); - this.WaitForLastReplOutputContains("REPL commands"); + VisualStudio.SendKeys.Send("\n"); + VisualStudio.InteractiveWindow.WaitForLastReplOutputContains("REPL commands"); } } } \ No newline at end of file diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveAsyncOutput.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveAsyncOutput.cs index 6f312db90443b..ffc2b1d77fbad 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveAsyncOutput.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveAsyncOutput.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.VisualStudio.IntegrationTest.Utilities; -using Roslyn.VisualStudio.IntegrationTests.Extensions.Interactive; using Xunit; namespace Roslyn.VisualStudio.IntegrationTests.CSharp @@ -17,9 +16,9 @@ public CSharpInteractiveAsyncOutput(VisualStudioInstanceFactory instanceFactory) [Fact] public void VerifyPreviousAndNextHistory() { - this.SubmitText(@"#cls"); + VisualStudio.InteractiveWindow.SubmitText(@"#cls"); - this.SubmitText(@"using System.Threading; + VisualStudio.InteractiveWindow.SubmitText(@"using System.Threading; var t1 = new Thread(() => { for (int i = 0; ; i++) { Console.WriteLine('$'); Thread.Sleep(500); } }); var t2 = new Thread(() => { for (int i = 0; ; i++) { Console.Write('$'); Thread.Sleep(101); } }); var t3 = new Thread(() => { while (true) { Console.Write('\r'); Thread.Sleep(1200); } }); @@ -27,42 +26,42 @@ public void VerifyPreviousAndNextHistory() t2.Start(); t3.Start();"); - this.SubmitText(@"#help"); + VisualStudio.InteractiveWindow.SubmitText(@"#help"); Wait(seconds: 1); - this.SubmitText(@"1+1"); + VisualStudio.InteractiveWindow.SubmitText(@"1+1"); Wait(seconds: 1); - this.SubmitText(@"1+2"); + VisualStudio.InteractiveWindow.SubmitText(@"1+2"); Wait(seconds: 1); - this.VerifyReplPromptConsistency(prompt: "....", output: "$"); + VisualStudio.InteractiveWindow.Verify.ReplPromptConsistency(prompt: "....", output: "$"); Wait(seconds: 1); - this.SubmitText(@"1+4"); + VisualStudio.InteractiveWindow.SubmitText(@"1+4"); Wait(seconds: 1); - this.SubmitText(@"1+5"); + VisualStudio.InteractiveWindow.SubmitText(@"1+5"); Wait(seconds: 1); - this.VerifyReplPromptConsistency(prompt: "....", output: "$"); + VisualStudio.InteractiveWindow.Verify.ReplPromptConsistency(prompt: "....", output: "$"); - this.SubmitText(@"#cls"); - this.SubmitText(@"1+5"); + VisualStudio.InteractiveWindow.SubmitText(@"#cls"); + VisualStudio.InteractiveWindow.SubmitText(@"1+5"); Wait(seconds: 1); - this.VerifyReplPromptConsistency(prompt: "....", output: "$"); + VisualStudio.InteractiveWindow.Verify.ReplPromptConsistency(prompt: "....", output: "$"); - this.SubmitText(@"t1.Abort(); + VisualStudio.InteractiveWindow.SubmitText(@"t1.Abort(); t1.Join(); t2.Abort(); t2.Join(); t3.Abort(); t3.Join();"); - this.ClearReplText(); - this.Reset(); + VisualStudio.InteractiveWindow.ClearReplText(); + VisualStudio.InteractiveWindow.Reset(); } } } diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveBoxSelection.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveBoxSelection.cs index 748f9ecf67d09..f03799b80082b 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveBoxSelection.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveBoxSelection.cs @@ -2,8 +2,6 @@ using Microsoft.VisualStudio.IntegrationTest.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities.Input; -using Roslyn.VisualStudio.IntegrationTests.Extensions; -using Roslyn.VisualStudio.IntegrationTests.Extensions.Interactive; using Xunit; namespace Roslyn.VisualStudio.IntegrationTests.CSharp @@ -14,12 +12,12 @@ public class CSharpInteractiveBoxSelection : AbstractInteractiveWindowTest public CSharpInteractiveBoxSelection(VisualStudioInstanceFactory instanceFactory) : base(instanceFactory) { - this.SubmitText("#cls"); + VisualStudio.InteractiveWindow.SubmitText("#cls"); } public new void Dispose() { - this.ExecuteCommand(WellKnownCommandNames.Edit_SelectionCancel); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_SelectionCancel); base.Dispose(); } @@ -28,11 +26,11 @@ public void TopLeftBottomRightPromptToSymbol() { InsertInputWithXAtLeft(); - this.PlaceCaret(">", 1); - this.PlaceCaret("x", 0, extendSelection: true, selectBlock: true); - this.SendKeys("__", VirtualKey.Escape, "|"); + VisualStudio.InteractiveWindow.PlaceCaret(">", 1); + VisualStudio.InteractiveWindow.PlaceCaret("x", 0, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("__", VirtualKey.Escape, "|"); - this.VerifyLastReplInput(@"__234567890ABCDEF + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"__234567890ABCDEF __234567890ABCDEF __234567890ABCDEF __234567890ABCDEF @@ -46,11 +44,11 @@ public void TopLeftBottomRightPromptToSymbol() public void BottomRightTopLeftPromptToSymbol() { InsertInputWithXAtLeft(); - this.PlaceCaret("x", 0); - this.PlaceCaret(">", 1, extendSelection: true, selectBlock: true); - this.SendKeys("__", VirtualKey.Escape, "|"); + VisualStudio.InteractiveWindow.PlaceCaret("x", 0); + VisualStudio.InteractiveWindow.PlaceCaret(">", 1, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("__", VirtualKey.Escape, "|"); - this.VerifyLastReplInput(@"__|234567890ABCDEF + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"__|234567890ABCDEF __234567890ABCDEF __234567890ABCDEF __234567890ABCDEF @@ -64,11 +62,11 @@ public void BottomRightTopLeftPromptToSymbol() public void TopRightBottomLeftPromptToSymbol() { InsertInputWithXAtLeft(); - this.PlaceCaret(">", 3); - this.PlaceCaret("x", -2, extendSelection: true, selectBlock: true); - this.SendKeys("__", VirtualKey.Escape, "|"); + VisualStudio.InteractiveWindow.PlaceCaret(">", 3); + VisualStudio.InteractiveWindow.PlaceCaret("x", -2, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("__", VirtualKey.Escape, "|"); - this.VerifyLastReplInput(@"__234567890ABCDEF + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"__234567890ABCDEF __234567890ABCDEF __234567890ABCDEF __234567890ABCDEF @@ -82,11 +80,11 @@ public void TopRightBottomLeftPromptToSymbol() public void BottomLeftTopRightPromptToSymbol() { InsertInputWithXAtLeft(); - this.PlaceCaret("x", -2); - this.PlaceCaret(">", 3, extendSelection: true, selectBlock: true); - this.SendKeys("__", VirtualKey.Escape, "|"); + VisualStudio.InteractiveWindow.PlaceCaret("x", -2); + VisualStudio.InteractiveWindow.PlaceCaret(">", 3, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("__", VirtualKey.Escape, "|"); - this.VerifyLastReplInput(@"__|234567890ABCDEF + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"__|234567890ABCDEF __234567890ABCDEF __234567890ABCDEF __234567890ABCDEF @@ -100,11 +98,11 @@ public void BottomLeftTopRightPromptToSymbol() public void TopLeftBottomRightSymbolToSymbol() { InsertInputWithSAndEAtLeft(); - this.PlaceCaret("s", -1); - this.PlaceCaret("e", 1, extendSelection: true, selectBlock: true); - this.SendKeys("__", VirtualKey.Escape, "|"); + VisualStudio.InteractiveWindow.PlaceCaret("s", -1); + VisualStudio.InteractiveWindow.PlaceCaret("e", 1, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("__", VirtualKey.Escape, "|"); - this.VerifyLastReplInput(@"1234567890ABCDEF + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"1234567890ABCDEF 1234567890ABCDEF __234567890ABCDEF __234567890ABCDEF @@ -118,11 +116,11 @@ public void TopLeftBottomRightSymbolToSymbol() public void BottomRightTopLeftSymbolToSymbol() { InsertInputWithSAndEAtLeft(); - this.PlaceCaret("e", 1); - this.PlaceCaret("s", -1, extendSelection: true, selectBlock: true); - this.SendKeys("__", VirtualKey.Escape, "|"); + VisualStudio.InteractiveWindow.PlaceCaret("e", 1); + VisualStudio.InteractiveWindow.PlaceCaret("s", -1, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("__", VirtualKey.Escape, "|"); - this.VerifyLastReplInput(@"1234567890ABCDEF + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"1234567890ABCDEF 1234567890ABCDEF __|234567890ABCDEF __234567890ABCDEF @@ -136,11 +134,11 @@ public void BottomRightTopLeftSymbolToSymbol() public void TopRightBottomLeftSymbolToSymbol() { InsertInputWithSAndEAtLeft(); - this.PlaceCaret("s", 1); - this.PlaceCaret("e", -1, extendSelection: true, selectBlock: true); - this.SendKeys("__", VirtualKey.Escape, "|"); + VisualStudio.InteractiveWindow.PlaceCaret("s", 1); + VisualStudio.InteractiveWindow.PlaceCaret("e", -1, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("__", VirtualKey.Escape, "|"); - this.VerifyLastReplInput(@"1234567890ABCDEF + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"1234567890ABCDEF 1234567890ABCDEF __234567890ABCDEF __234567890ABCDEF @@ -155,11 +153,11 @@ public void TopRightBottomLeftSymbolToSymbol() public void BottomLeftTopRightSymbolToSymbol() { InsertInputWithSAndEAtLeft(); - this.PlaceCaret("e", -1); - this.PlaceCaret("s", 1, extendSelection: true, selectBlock: true); - this.SendKeys("__", VirtualKey.Escape, "|"); + VisualStudio.InteractiveWindow.PlaceCaret("e", -1); + VisualStudio.InteractiveWindow.PlaceCaret("s", 1, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("__", VirtualKey.Escape, "|"); - this.VerifyLastReplInput(@"1234567890ABCDEF + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"1234567890ABCDEF 1234567890ABCDEF __|234567890ABCDEF __234567890ABCDEF @@ -173,11 +171,11 @@ public void BottomLeftTopRightSymbolToSymbol() public void TopLeftBottomRightSelection1() { InsertInputWithSAndEAtLeft(); - this.PlaceCaret("s", -3); - this.PlaceCaret("e", 2, extendSelection: true, selectBlock: true); - this.SendKeys("_"); + VisualStudio.InteractiveWindow.PlaceCaret("s", -3); + VisualStudio.InteractiveWindow.PlaceCaret("e", 2, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("_"); - this.VerifyLastReplInput(@"1234567890ABCDEF + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"1234567890ABCDEF 1234567890ABCDEF _34567890ABCDEF _34567890ABCDEF @@ -191,9 +189,9 @@ public void TopLeftBottomRightSelection1() public void TopLeftBottomRightSelection2() { InsertInputWithSAndEAtLeft(); - this.PlaceCaret("e", -2); - this.PlaceCaret("s", -3, extendSelection: true, selectBlock: true); - this.SendKeys("_"); + VisualStudio.InteractiveWindow.PlaceCaret("e", -2); + VisualStudio.InteractiveWindow.PlaceCaret("s", -3, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("_"); VerifyOriginalCodeWithSAndEAtLeft(); } @@ -202,9 +200,9 @@ public void TopLeftBottomRightSelection2() public void TopRightBottomLeftSelection() { InsertInputWithSAndEAtLeft(); - this.PlaceCaret("s", -2); - this.PlaceCaret("e", -3, extendSelection: true, selectBlock: true); - this.SendKeys("_"); + VisualStudio.InteractiveWindow.PlaceCaret("s", -2); + VisualStudio.InteractiveWindow.PlaceCaret("e", -3, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("_"); VerifyOriginalCodeWithSAndEAtLeft(); } @@ -213,9 +211,9 @@ public void TopRightBottomLeftSelection() public void BottomLeftTopRightSelection() { InsertInputWithSAndEAtLeft(); - this.PlaceCaret("e", -3); - this.PlaceCaret("s", -2, extendSelection: true, selectBlock: true); - this.SendKeys("_"); + VisualStudio.InteractiveWindow.PlaceCaret("e", -3); + VisualStudio.InteractiveWindow.PlaceCaret("s", -2, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("_"); VerifyOriginalCodeWithSAndEAtLeft(); } @@ -224,11 +222,11 @@ public void BottomLeftTopRightSelection() public void SelectionTouchingSubmissionBuffer() { InsertInputWithSAndEAtLeft(); - this.PlaceCaret("s", -2); - this.PlaceCaret("e", -1, extendSelection: true, selectBlock: true); - this.SendKeys("__"); + VisualStudio.InteractiveWindow.PlaceCaret("s", -2); + VisualStudio.InteractiveWindow.PlaceCaret("e", -1, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("__"); - this.VerifyLastReplInput(@"1234567890ABCDEF + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"1234567890ABCDEF 1234567890ABCDEF __s234567890ABCDEF __1234567890ABCDEF @@ -242,11 +240,11 @@ public void SelectionTouchingSubmissionBuffer() public void PrimaryPromptLongerThanSecondaryZeroWidthNextToPromptSelection() { InsertInputWithSAndEAtLeft(); - this.PlaceCaret("s", -1); - this.PlaceCaret("e", -1, extendSelection: true, selectBlock: true); - this.SendKeys("__"); + VisualStudio.InteractiveWindow.PlaceCaret("s", -1); + VisualStudio.InteractiveWindow.PlaceCaret("e", -1, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("__"); - this.VerifyLastReplInput(@"1234567890ABCDEF + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"1234567890ABCDEF 1234567890ABCDEF __s234567890ABCDEF __1234567890ABCDEF @@ -260,29 +258,29 @@ public void PrimaryPromptLongerThanSecondaryZeroWidthNextToPromptSelection() public void Backspace() { InsertInputWithSAndEInTheMiddle(); - this.PlaceCaret("s", -1); - this.PlaceCaret("e", 0, extendSelection: true, selectBlock: true); - this.SendKeys(VirtualKey.Backspace, VirtualKey.Backspace); + VisualStudio.InteractiveWindow.PlaceCaret("s", -1); + VisualStudio.InteractiveWindow.PlaceCaret("e", 0, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send(VirtualKey.Backspace, VirtualKey.Backspace); - this.VerifyLastReplInput(@"1CDEF + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"1CDEF 1CDEF 1CDEF 1CDEF 1CDEF 1CDEF 1CDEF -1234567890ABCDEF"); +1234567890ABCDEF"); } [Fact] public void BackspaceBehavesLikeDelete() { InsertInputWithEInTheMiddle(); - this.PlaceCaret(">", 0); - this.PlaceCaret("e", 0, extendSelection: true, selectBlock: true); - this.SendKeys(VirtualKey.Backspace, VirtualKey.Backspace); + VisualStudio.InteractiveWindow.PlaceCaret(">", 0); + VisualStudio.InteractiveWindow.PlaceCaret("e", 0, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send(VirtualKey.Backspace, VirtualKey.Backspace); - this.VerifyLastReplInput(@"CDEF + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"CDEF CDEF CDEF CDEF @@ -291,43 +289,43 @@ public void BackspaceBehavesLikeDelete() CDEF 1234567890ABCDEF"); } - + [Fact] public void LeftToRightReversedBackspace() { - this.InsertCode("1234567890ABCDEF"); - this.PlaceCaret("2", -5); - this.PlaceCaret(">", 8, extendSelection: true, selectBlock: true); - this.SendKeys(VirtualKey.Backspace); + VisualStudio.InteractiveWindow.InsertCode("1234567890ABCDEF"); + VisualStudio.InteractiveWindow.PlaceCaret("2", -5); + VisualStudio.InteractiveWindow.PlaceCaret(">", 8, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send(VirtualKey.Backspace); - this.VerifyLastReplInput(@"7890ABCDEF"); + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"7890ABCDEF"); } [Fact] public void LeftToRightReversedDelete() { - this.InsertCode("1234567890ABCDEF"); - this.PlaceCaret("1", -1); - this.PlaceCaret(">", 5, extendSelection: true, selectBlock: true); - this.SendKeys(VirtualKey.Delete); + VisualStudio.InteractiveWindow.InsertCode("1234567890ABCDEF"); + VisualStudio.InteractiveWindow.PlaceCaret("1", -1); + VisualStudio.InteractiveWindow.PlaceCaret(">", 5, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send(VirtualKey.Delete); - this.VerifyLastReplInput(@"4567890ABCDEF"); + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"4567890ABCDEF"); } [Fact] public void LeftToRightReversedTypeCharacter() { - this.InsertCode("1234567890ABCDEF"); - this.PlaceCaret("1", -1); - this.PlaceCaret(">", 5, extendSelection: true, selectBlock: true); - this.SendKeys("__"); + VisualStudio.InteractiveWindow.InsertCode("1234567890ABCDEF"); + VisualStudio.InteractiveWindow.PlaceCaret("1", -1); + VisualStudio.InteractiveWindow.PlaceCaret(">", 5, extendSelection: true, selectBlock: true); + VisualStudio.SendKeys.Send("__"); - this.VerifyLastReplInput(@"__4567890ABCDEF"); + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"__4567890ABCDEF"); } private void InsertInputWithXAtLeft() { - this.InsertCode(@"1234567890ABCDEF + VisualStudio.InteractiveWindow.InsertCode(@"1234567890ABCDEF 1234567890ABCDEF 1234567890ABCDEF 1234567890ABCDEF @@ -339,7 +337,7 @@ private void InsertInputWithXAtLeft() private void InsertInputWithSAndEAtLeft() { - this.InsertCode(@"1234567890ABCDEF + VisualStudio.InteractiveWindow.InsertCode(@"1234567890ABCDEF 1234567890ABCDEF s234567890ABCDEF 1234567890ABCDEF @@ -351,7 +349,7 @@ private void InsertInputWithSAndEAtLeft() private void InsertInputWithSAndEInTheMiddle() { - this.InsertCode(@"12s4567890ABCDEF + VisualStudio.InteractiveWindow.InsertCode(@"12s4567890ABCDEF 1234567890ABCDEF 1234567890ABCDEF 1234567890ABCDEF @@ -363,7 +361,7 @@ private void InsertInputWithSAndEInTheMiddle() private void InsertInputWithEInTheMiddle() { - this.InsertCode(@"1234567890ABCDEF + VisualStudio.InteractiveWindow.InsertCode(@"1234567890ABCDEF 1234567890ABCDEF 1234567890ABCDEF 1234567890ABCDEF @@ -375,7 +373,7 @@ private void InsertInputWithEInTheMiddle() private void VerifyOriginalCodeWithSAndEAtLeft() { - this.VerifyLastReplInput(@"1234567890ABCDEF + VisualStudio.InteractiveWindow.Verify.LastReplInput(@"1234567890ABCDEF 1234567890ABCDEF s234567890ABCDEF 1234567890ABCDEF diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveCommands.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveCommands.cs index a76cfba42e7e1..38a0d67f9e7d7 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveCommands.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveCommands.cs @@ -2,8 +2,6 @@ using Microsoft.VisualStudio.IntegrationTest.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities.Input; -using Roslyn.VisualStudio.IntegrationTests.Extensions; -using Roslyn.VisualStudio.IntegrationTests.Extensions.Interactive; using Xunit; namespace Roslyn.VisualStudio.IntegrationTests.CSharp @@ -19,112 +17,112 @@ public CSharpInteractiveCommands(VisualStudioInstanceFactory instanceFactory) [Fact] public void VerifyPreviousAndNextHistory() { - this.SubmitText("1 + 2"); - this.SubmitText("1.ToString()"); - this.WaitForLastReplOutput("\"1\""); - this.SendKeys(Alt(VirtualKey.Up)); - this.VerifyLastReplInput("1.ToString()"); - this.SendKeys(VirtualKey.Enter); - this.WaitForLastReplOutput("\"1\""); - this.SendKeys(Alt(VirtualKey.Up)); - this.VerifyLastReplInput("1.ToString()"); - this.SendKeys(Alt(VirtualKey.Up)); - this.VerifyLastReplInput("1 + 2"); - this.SendKeys(VirtualKey.Enter); - this.WaitForLastReplOutput("3"); - this.SendKeys(Alt(VirtualKey.Down)); - this.VerifyLastReplInput("1.ToString()"); - this.SendKeys(VirtualKey.Enter); - this.WaitForLastReplOutput("\"1\""); + VisualStudio.InteractiveWindow.SubmitText("1 + 2"); + VisualStudio.InteractiveWindow.SubmitText("1.ToString()"); + VisualStudio.InteractiveWindow.WaitForLastReplOutput("\"1\""); + VisualStudio.SendKeys.Send(Alt(VirtualKey.Up)); + VisualStudio.InteractiveWindow.Verify.LastReplInput("1.ToString()"); + VisualStudio.SendKeys.Send(VirtualKey.Enter); + VisualStudio.InteractiveWindow.WaitForLastReplOutput("\"1\""); + VisualStudio.SendKeys.Send(Alt(VirtualKey.Up)); + VisualStudio.InteractiveWindow.Verify.LastReplInput("1.ToString()"); + VisualStudio.SendKeys.Send(Alt(VirtualKey.Up)); + VisualStudio.InteractiveWindow.Verify.LastReplInput("1 + 2"); + VisualStudio.SendKeys.Send(VirtualKey.Enter); + VisualStudio.InteractiveWindow.WaitForLastReplOutput("3"); + VisualStudio.SendKeys.Send(Alt(VirtualKey.Down)); + VisualStudio.InteractiveWindow.Verify.LastReplInput("1.ToString()"); + VisualStudio.SendKeys.Send(VirtualKey.Enter); + VisualStudio.InteractiveWindow.WaitForLastReplOutput("\"1\""); } [Fact] public void VerifyMaybeExecuteInput() { - this.InsertCode("2 + 3"); - this.SendKeys(VirtualKey.Enter); - this.WaitForLastReplOutput("5"); + VisualStudio.InteractiveWindow.InsertCode("2 + 3"); + VisualStudio.SendKeys.Send(VirtualKey.Enter); + VisualStudio.InteractiveWindow.WaitForLastReplOutput("5"); } [Fact] public void VerifyNewLineAndIndent() { - this.InsertCode("3 + "); - this.SendKeys(VirtualKey.Enter); - this.InsertCode("4"); - this.SendKeys(VirtualKey.Enter); - this.WaitForLastReplOutput("7"); + VisualStudio.InteractiveWindow.InsertCode("3 + "); + VisualStudio.SendKeys.Send(VirtualKey.Enter); + VisualStudio.InteractiveWindow.InsertCode("4"); + VisualStudio.SendKeys.Send(VirtualKey.Enter); + VisualStudio.InteractiveWindow.WaitForLastReplOutput("7"); } [Fact] public void VerifyExecuteInput() { - this.SubmitText("1 + "); - this.WaitForLastReplOutputContains("CS1733"); + VisualStudio.InteractiveWindow.SubmitText("1 + "); + VisualStudio.InteractiveWindow.WaitForLastReplOutputContains("CS1733"); } [Fact] public void VerifyForceNewLineAndIndent() { - this.InsertCode("1 + 2"); - this.SendKeys(VirtualKey.Enter); - this.SubmitText("+ 3"); - this.WaitForLastReplOutputContains("3"); - this.VerifyReplPromptConsistency("", "6"); + VisualStudio.InteractiveWindow.InsertCode("1 + 2"); + VisualStudio.SendKeys.Send(VirtualKey.Enter); + VisualStudio.InteractiveWindow.SubmitText("+ 3"); + VisualStudio.InteractiveWindow.WaitForLastReplOutputContains("3"); + VisualStudio.InteractiveWindow.Verify.ReplPromptConsistency("", "6"); } [Fact] public void VerifyCancelInput() { - this.InsertCode("1 + 4"); - this.SendKeys(Shift(VirtualKey.Enter)); - this.SendKeys(VirtualKey.Escape); - this.VerifyLastReplInput(string.Empty); + VisualStudio.InteractiveWindow.InsertCode("1 + 4"); + VisualStudio.SendKeys.Send(Shift(VirtualKey.Enter)); + VisualStudio.SendKeys.Send(VirtualKey.Escape); + VisualStudio.InteractiveWindow.Verify.LastReplInput(string.Empty); } [Fact] public void VerifyUndoAndRedo() { - this.ClearReplText(); - this.InsertCode(" 2 + 4 "); - this.SendKeys(Ctrl(VirtualKey.Z)); - this.VerifyReplPromptConsistency("< ![CDATA[]] >", string.Empty); - this.SendKeys(Ctrl(VirtualKey.Y)); - this.VerifyLastReplInput(" 2 + 4 "); - this.SendKeys(VirtualKey.Enter); - this.WaitForLastReplOutput("6"); + VisualStudio.InteractiveWindow.ClearReplText(); + VisualStudio.InteractiveWindow.InsertCode(" 2 + 4 "); + VisualStudio.SendKeys.Send(Ctrl(VirtualKey.Z)); + VisualStudio.InteractiveWindow.Verify.ReplPromptConsistency("< ![CDATA[]] >", string.Empty); + VisualStudio.SendKeys.Send(Ctrl(VirtualKey.Y)); + VisualStudio.InteractiveWindow.Verify.LastReplInput(" 2 + 4 "); + VisualStudio.SendKeys.Send(VirtualKey.Enter); + VisualStudio.InteractiveWindow.WaitForLastReplOutput("6"); } [Fact] public void CutDeletePasteSelectAll() { ClearInteractiveWindow(); - this.InsertCode("Text"); - this.ExecuteCommand(WellKnownCommandNames.Edit_LineStart); - this.ExecuteCommand(WellKnownCommandNames.Edit_LineEnd); - this.ExecuteCommand(WellKnownCommandNames.Edit_LineStartExtend); - this.ExecuteCommand(WellKnownCommandNames.Edit_SelectionCancel); - this.ExecuteCommand(WellKnownCommandNames.Edit_LineEndExtend); - this.ExecuteCommand(WellKnownCommandNames.Edit_SelectAll); - this.ExecuteCommand(WellKnownCommandNames.Edit_SelectAll); - this.ExecuteCommand(WellKnownCommandNames.Edit_Copy); - this.ExecuteCommand(WellKnownCommandNames.Edit_Cut); - this.ExecuteCommand(WellKnownCommandNames.Edit_Paste); - this.WaitForLastReplInputContains("Text"); - this.VerifyLastReplInput("Text"); - this.ExecuteCommand(WellKnownCommandNames.Edit_Delete); - this.ExecuteCommand(WellKnownCommandNames.Edit_LineUp); - this.ExecuteCommand(WellKnownCommandNames.Edit_LineDown); - this.ExecuteCommand(WellKnownCommandNames.Edit_Paste); - this.WaitForLastReplInputContains("TextText"); - this.VerifyLastReplInput("TextText"); - this.ExecuteCommand(WellKnownCommandNames.Edit_Paste); - this.WaitForLastReplInputContains("TextTextText"); - this.VerifyLastReplInput("TextTextText"); - this.SendKeys(VirtualKey.Escape); + VisualStudio.InteractiveWindow.InsertCode("Text"); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_LineStart); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_LineEnd); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_LineStartExtend); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_SelectionCancel); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_LineEndExtend); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_SelectAll); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_SelectAll); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_Copy); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_Cut); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_Paste); + VisualStudio.InteractiveWindow.WaitForLastReplInputContains("Text"); + VisualStudio.InteractiveWindow.Verify.LastReplInput("Text"); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_Delete); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_LineUp); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_LineDown); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_Paste); + VisualStudio.InteractiveWindow.WaitForLastReplInputContains("TextText"); + VisualStudio.InteractiveWindow.Verify.LastReplInput("TextText"); + VisualStudio.ExecuteCommand(WellKnownCommandNames.Edit_Paste); + VisualStudio.InteractiveWindow.WaitForLastReplInputContains("TextTextText"); + VisualStudio.InteractiveWindow.Verify.LastReplInput("TextTextText"); + VisualStudio.SendKeys.Send(VirtualKey.Escape); } - //