diff --git a/src/EditorFeatures/VisualBasicTest/CodeActions/EncapsulateField/EncapsulateFieldTests.vb b/src/EditorFeatures/VisualBasicTest/CodeActions/EncapsulateField/EncapsulateFieldTests.vb index 52ef69b0dfbd4b8de282bd28787755141a118135..1d11500b4995218b910694cef6ff8c688afa7dfe 100644 --- a/src/EditorFeatures/VisualBasicTest/CodeActions/EncapsulateField/EncapsulateFieldTests.vb +++ b/src/EditorFeatures/VisualBasicTest/CodeActions/EncapsulateField/EncapsulateFieldTests.vb @@ -4,9 +4,16 @@ Imports Microsoft.CodeAnalysis.CodeRefactorings Imports Microsoft.CodeAnalysis.CodeStyle +Imports Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions Imports Microsoft.CodeAnalysis.EncapsulateField +Imports Microsoft.CodeAnalysis.Test.Utilities.RemoteHost Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings.EncapsulateField + Public Enum TestHost + InProcess + OutOfProcess + End Enum + Public Class EncapsulateFieldTests Inherits AbstractVisualBasicCodeActionTest @@ -14,8 +21,14 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings.E Return New EncapsulateFieldRefactoringProvider() End Function - - Public Async Function TestEncapsulatePrivateFieldAndUpdateReferences() As Task + Private Function GetHostOptions(host As TestHost) As OptionsCollection + Return New OptionsCollection(GetLanguage()) From { + {RemoteHostOptions.RemoteHostTest, host <> TestHost.InProcess} + } + End Function + + + Public Async Function TestEncapsulatePrivateFieldAndUpdateReferences(host As TestHost) As Task Dim text = Class C Private ReadOnly x[||] As Integer @@ -48,12 +61,11 @@ Class C End Sub End Class.ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected) - + Await TestInRegularAndScriptAsync(text, expected, options:=GetHostOptions(host)) End Function - - Public Async Function TestEncapsulateDimField() As Task + + Public Async Function TestEncapsulateDimField(host As TestHost) As Task Dim text = Class C Dim x[||] As Integer @@ -81,12 +93,12 @@ Class C End Sub End Class.ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected) + Await TestInRegularAndScriptAsync(text, expected, options:=GetHostOptions(host)) End Function - - Public Async Function TestEncapsulateGenericField() As Task + + Public Async Function TestEncapsulateGenericField(host As TestHost) As Task Dim text = Class C(Of T) Dim x[||] As T @@ -114,12 +126,12 @@ Class C(Of T) End Sub End Class.ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected) + Await TestInRegularAndScriptAsync(text, expected, options:=GetHostOptions(host)) End Function - - Public Async Function TestEncapsulatePublicFieldIgnoringReferences() As Task + + Public Async Function TestEncapsulatePublicFieldIgnoringReferences(host As TestHost) As Task Dim text = Class C Public [|x|] As Integer @@ -147,11 +159,11 @@ Class C End Sub End Class.ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected, index:=1) + Await TestInRegularAndScriptAsync(text, expected, index:=1, options:=GetHostOptions(host)) End Function - - Public Async Function TestEncapsulatePublicFieldUpdatingReferences() As Task + + Public Async Function TestEncapsulatePublicFieldUpdatingReferences(host As TestHost) As Task Dim text = Class C Public [|x|] As Integer @@ -179,11 +191,11 @@ Class C End Sub End Class.ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected) + Await TestInRegularAndScriptAsync(text, expected, options:=GetHostOptions(host)) End Function - - Public Async Function TestEncapsulateMultiplePrivateFieldsWithReferences() As Task + + Public Async Function TestEncapsulateMultiplePrivateFieldsWithReferences(host As TestHost) As Task Dim text = Class C Private [|x, y|] As Integer @@ -222,11 +234,11 @@ Class C End Sub End Class.ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected) + Await TestInRegularAndScriptAsync(text, expected, options:=GetHostOptions(host)) End Function - - Public Async Function TestEncapsulateMultiplePublicFieldsWithReferences() As Task + + Public Async Function TestEncapsulateMultiplePublicFieldsWithReferences(host As TestHost) As Task Dim text = Class C [|Public x As String @@ -267,11 +279,11 @@ Class C End Sub End Class.ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected, index:=1) + Await TestInRegularAndScriptAsync(text, expected, index:=1, options:=GetHostOptions(host)) End Function - - Public Async Function TestNoSetterForConstField() As Task + + Public Async Function TestNoSetterForConstField(host As TestHost) As Task Dim text = Class Program Private Const [|goo|] As Integer = 3 @@ -288,12 +300,12 @@ Class Program End Property End Class.ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected) + Await TestInRegularAndScriptAsync(text, expected, options:=GetHostOptions(host)) End Function - - Public Async Function TestEncapsulateEscapedIdentifier() As Task + + Public Async Function TestEncapsulateEscapedIdentifier(host As TestHost) As Task Dim text = Class C Private [|[Class]|] As String @@ -313,12 +325,12 @@ Class C End Property End Class.ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected) + Await TestInRegularAndScriptAsync(text, expected, options:=GetHostOptions(host)) End Function - - Public Async Function TestEncapsulateEscapedIdentifierWithQualifiedAccess() As Task + + Public Async Function TestEncapsulateEscapedIdentifierWithQualifiedAccess(host As TestHost) As Task Dim text = Class C Private [|[Class]|] As String @@ -338,12 +350,16 @@ Class C End Property End Class.ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected, options:=[Option](CodeStyleOptions2.QualifyFieldAccess, True, NotificationOption2.Error)) - + Await TestInRegularAndScriptAsync( + text, expected, + options:=New OptionsCollection(GetLanguage()) From { + {CodeStyleOptions2.QualifyFieldAccess, True, NotificationOption2.Error}, + {RemoteHostOptions.RemoteHostTest, host <> TestHost.InProcess} + }) End Function - - Public Async Function TestEncapsulateFieldNamedValue() As Task + + Public Async Function TestEncapsulateFieldNamedValue(host As TestHost) As Task Dim text = Class C Private [|value|] As Integer = 3 @@ -363,12 +379,12 @@ Class C End Property End Class.ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected) + Await TestInRegularAndScriptAsync(text, expected, options:=GetHostOptions(host)) End Function - - Public Async Function TestEncapsulateFieldName__() As Task + + Public Async Function TestEncapsulateFieldName__(host As TestHost) As Task Dim text = Class D Public [|__|] As Integer @@ -390,12 +406,12 @@ Class D End Class .ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected) + Await TestInRegularAndScriptAsync(text, expected, options:=GetHostOptions(host)) End Function - - Public Async Function TestPreserveTrivia() As Task + + Public Async Function TestPreserveTrivia(host As TestHost) As Task Dim text = Class AA Private name As String : Public [|dsds|] As Integer @@ -417,12 +433,12 @@ Class AA End Class .ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected) + Await TestInRegularAndScriptAsync(text, expected, options:=GetHostOptions(host)) End Function - - Public Async Function TestNewPropertyNameIsUnique() As Task + + Public Async Function TestNewPropertyNameIsUnique(host As TestHost) As Task Dim text = Class AA Private [|name|] As String @@ -460,23 +476,23 @@ Class AA End Class .ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected) + Await TestInRegularAndScriptAsync(text, expected, options:=GetHostOptions(host)) End Function - - Public Async Function TestAvailableNotJustOnVariableName() As Task + + Public Async Function TestAvailableNotJustOnVariableName(host As TestHost) As Task Dim text = Class C Private [||] ReadOnly x As Integer End Class.ConvertTestSourceTag() - Await TestActionCountAsync(text, 2) + Await TestActionCountAsync(text, 2, New TestParameters(options:=GetHostOptions(host))) End Function - - Public Async Function TestCopyAccessibility() As Task + + Public Async Function TestCopyAccessibility(host As TestHost) As Task Dim text = Class C Protected [|x|] As Integer @@ -496,12 +512,12 @@ Class C End Property End Class.ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected) + Await TestInRegularAndScriptAsync(text, expected, options:=GetHostOptions(host)) End Function - - Public Async Function TestBackingFieldStartsWithUnderscore() As Task + + Public Async Function TestBackingFieldStartsWithUnderscore(host As TestHost) As Task Dim text = Public Class Class1 Public [|Name|] As String @@ -530,11 +546,11 @@ Public Class Class1 End Class .ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected) + Await TestInRegularAndScriptAsync(text, expected, options:=GetHostOptions(host)) End Function - - Public Async Function TestEncapsulateShadowingField() As Task + + Public Async Function TestEncapsulateShadowingField(host As TestHost) As Task Dim text = Class C Protected _goo As Integer @@ -584,16 +600,16 @@ Class D End Property End Class.ConvertTestSourceTag() - Await TestInRegularAndScriptAsync(text, expected) + Await TestInRegularAndScriptAsync(text, expected, options:=GetHostOptions(host)) End Function - - Public Async Function TestDoNotEncapsulateOutsideTypeDeclaration() As Task + + Public Async Function TestDoNotEncapsulateOutsideTypeDeclaration(host As TestHost) As Task Dim globalField = Dim [|x|] = 1 .ConvertTestSourceTag() - Await TestMissingInRegularAndScriptAsync(globalField) + Await TestMissingInRegularAndScriptAsync(globalField, New TestParameters(options:=GetHostOptions(host))) Dim namespaceField = @@ -601,20 +617,20 @@ Namespace N Dim [|x|] = 1 End Namespace .ConvertTestSourceTag() - Await TestMissingInRegularAndScriptAsync(namespaceField) + Await TestMissingInRegularAndScriptAsync(namespaceField, New TestParameters(options:=GetHostOptions(host))) Dim enumField = Enum E [|x|] = 1 End Enum .ConvertTestSourceTag() - Await TestMissingInRegularAndScriptAsync(enumField) + Await TestMissingInRegularAndScriptAsync(enumField, New TestParameters(options:=GetHostOptions(host))) End Function - - Public Async Function ApplyCurrentMePrefixStyle() As Task + + Public Async Function ApplyCurrentMePrefixStyle(host As TestHost) As Task Await TestInRegularAndScriptAsync(" Class C Dim [|i|] As Integer @@ -633,7 +649,10 @@ Class C End Property End Class ", -options:=[Option](CodeStyleOptions2.QualifyFieldAccess, True, NotificationOption2.Error)) +options:=New OptionsCollection(GetLanguage()) From { + {CodeStyleOptions2.QualifyFieldAccess, True, NotificationOption2.Error}, + {RemoteHostOptions.RemoteHostTest, host <> TestHost.InProcess} +}) End Function End Class End Namespace