diff --git a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeAttributeTests.vb b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeAttributeTests.vb index e7fd74e853c5770dfdc5e8c6d3f2cd8af41017a7..e7c64ba22244da77162698419dfca24db4539a58 100644 --- a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeAttributeTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeAttributeTests.vb @@ -55,8 +55,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Return codeElement.AddArgument(data.Value, data.Name, data.Position) End Function - Protected Sub TestAttributeArguments(code As XElement, ParamArray expectedAttributeArguments() As Action(Of Object)) - TestElement(code, + Protected Async Function TestAttributeArguments(code As XElement, ParamArray expectedAttributeArguments() As Action(Of Object)) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim attributes = GetAttributeArguments(codeElement) Assert.Equal(expectedAttributeArguments.Length, attributes.Count) @@ -65,61 +65,61 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel expectedAttributeArguments(i - 1)(attributes.Item(i)) Next End Sub) - End Sub + End Function - Protected Sub TestTarget(code As XElement, expectedTarget As String) - TestElement(code, + Protected Async Function TestTarget(code As XElement, expectedTarget As String) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim target = GetTarget(codeElement) Assert.Equal(expectedTarget, target) End Sub) - End Sub + End Function - Protected Sub TestSetTarget(code As XElement, expectedCode As XElement, target As String) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetTarget(code As XElement, expectedCode As XElement, target As String) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) codeElement.Target = target End Sub) - End Sub + End Function - Protected Sub TestValue(code As XElement, expectedValue As String) - TestElement(code, + Protected Async Function TestValue(code As XElement, expectedValue As String) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim target = GetValue(codeElement) Assert.Equal(expectedValue, target) End Sub) - End Sub + End Function - Protected Sub TestSetValue(code As XElement, expectedCode As XElement, value As String) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetValue(code As XElement, expectedCode As XElement, value As String) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) codeElement.Value = value End Sub) - End Sub + End Function - Protected Sub TestAddAttributeArgument(code As XElement, expectedCode As XElement, data As AttributeArgumentData) - TestElementUpdate(code, expectedCode, + Protected Async Function TestAddAttributeArgument(code As XElement, expectedCode As XElement, data As AttributeArgumentData) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim attributeArgument = AddAttributeArgument(codeElement, data) Assert.NotNull(attributeArgument) Assert.Equal(data.Name, attributeArgument.Name) End Sub) - End Sub + End Function - Protected Sub TestDelete(code As XElement, expectedCode As XElement) - TestElementUpdate(code, expectedCode, + Protected Async Function TestDelete(code As XElement, expectedCode As XElement) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) codeElement.Delete() End Sub) - End Sub + End Function - Protected Sub TestDeleteAttributeArgument(code As XElement, expectedCode As XElement, indexToDelete As Integer) - TestElementUpdate(code, expectedCode, + Protected Async Function TestDeleteAttributeArgument(code As XElement, expectedCode As XElement, indexToDelete As Integer) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim argument = CType(codeElement.Arguments.Item(indexToDelete), EnvDTE80.CodeAttributeArgument) argument.Delete() End Sub) - End Sub + End Function Protected Function IsAttributeArgument(Optional name As String = Nothing, Optional value As String = Nothing) As Action(Of Object) Return _ @@ -137,8 +137,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel End Sub End Function - Protected Sub TestAttributeArgumentStartPoint(code As XElement, index As Integer, ParamArray expectedParts() As Action(Of Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint))) - TestElement(code, + Protected Async Function TestAttributeArgumentStartPoint(code As XElement, index As Integer, ParamArray expectedParts() As Action(Of Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint))) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim arg = CType(codeElement.Arguments.Item(index), EnvDTE80.CodeAttributeArgument) @@ -148,10 +148,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel action(startPointGetter) Next End Sub) - End Sub + End Function - Protected Sub TestAttributeArgumentEndPoint(code As XElement, index As Integer, ParamArray expectedParts() As Action(Of Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint))) - TestElement(code, + Protected Async Function TestAttributeArgumentEndPoint(code As XElement, index As Integer, ParamArray expectedParts() As Action(Of Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint))) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim arg = CType(codeElement.Arguments.Item(index), EnvDTE80.CodeAttributeArgument) @@ -161,7 +161,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel action(endPointGetter) Next End Sub) - End Sub + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeClassTests.vb b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeClassTests.vb index e1ffa6a05e8eee224535206200c5538be724fa08..c64eed22dc85e0b2248ba9ee7f564cea99216552 100644 --- a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeClassTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeClassTests.vb @@ -166,8 +166,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel codeElement.RemoveInterface(element) End Sub - Protected Sub TestGetBaseName(code As XElement, expectedBaseName As String) - TestElement(code, + Protected Async Function TestGetBaseName(code As XElement, expectedBaseName As String) As Threading.Tasks.Task + Await TestElement(code, Sub(codeClass) Dim codeClassBase = TryCast(codeClass, ICodeClassBase) Assert.NotNull(codeClassBase) @@ -178,6 +178,6 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Assert.Equal(expectedBaseName, baseName) End Sub) - End Sub + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeDelegateTests.vb b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeDelegateTests.vb index 17dec1b008884f7388b4e5c75b46a5a462aedb33..e63689d52e046fff692b0a6a73e58c3eb61523d5 100644 --- a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeDelegateTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeDelegateTests.vb @@ -76,13 +76,13 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel codeElement.RemoveParameter(child) End Sub - Protected Sub TestBaseClass(code As XElement, expectedFullName As String) - TestElement(code, + Protected Async Function TestBaseClass(code As XElement, expectedFullName As String) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.NotNull(codeElement.BaseClass) Assert.Equal(expectedFullName, codeElement.BaseClass.FullName) End Sub) - End Sub + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeElementTests`1.vb b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeElementTests`1.vb index 6f4f216125cb37b22669cde1a7e6701cd792a611..01d2f10a7550f909c9dc64e05382a7f92928c74e 100644 --- a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeElementTests`1.vb +++ b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeElementTests`1.vb @@ -22,17 +22,17 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel codeElement) End Function - Protected Sub TestElement(code As XElement, expected As Action(Of TCodeElement)) - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Protected Async Function TestElement(code As XElement, expected As Action(Of TCodeElement)) As Tasks.Task + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim codeElement = GetCodeElement(state) Assert.NotNull(codeElement) expected(codeElement) End Using - End Sub + End Function - Protected Overloads Sub TestElementUpdate(code As XElement, expectedCode As XElement, updater As Action(Of TCodeElement)) - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Protected Overloads Async Function TestElementUpdate(code As XElement, expectedCode As XElement, updater As Action(Of TCodeElement)) As Tasks.Task + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim codeElement = GetCodeElement(state) Assert.NotNull(codeElement) @@ -41,10 +41,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Dim text = state.GetDocumentAtCursor().GetTextAsync(CancellationToken.None).Result.ToString() Assert.Equal(expectedCode.NormalizedValue.Trim(), text.Trim()) End Using - End Sub + End Function - Friend Overloads Sub TestElementUpdate(code As XElement, expectedCode As XElement, updater As Action(Of CodeModelTestState, TCodeElement)) - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Friend Overloads Async Function TestElementUpdate(code As XElement, expectedCode As XElement, updater As Action(Of CodeModelTestState, TCodeElement)) As Tasks.Task + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim codeElement = GetCodeElement(state) Assert.NotNull(codeElement) @@ -53,7 +53,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Dim text = state.GetDocumentAtCursor().GetTextAsync(CancellationToken.None).Result.ToString() Assert.Equal(expectedCode.NormalizedValue.Trim(), text.Trim()) End Using - End Sub + End Function Protected Delegate Sub PartAction(part As EnvDTE.vsCMPart, textPointGetter As Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint)) @@ -410,8 +410,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Throw New NotSupportedException End Sub - Protected Sub TestPropertyDescriptors(code As XElement, ParamArray expectedPropertyNames As String()) - TestElement(code, + Protected Async Function TestPropertyDescriptors(code As XElement, ParamArray expectedPropertyNames As String()) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim propertyDescriptors = ComponentModel.TypeDescriptor.GetProperties(codeElement) Dim propertyNames = propertyDescriptors _ @@ -421,10 +421,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Assert.Equal(expectedPropertyNames, propertyNames) End Sub) - End Sub + End Function - Protected Sub TestGetStartPoint(code As XElement, ParamArray expectedParts() As Action(Of Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint))) - TestElement(code, + Protected Async Function TestGetStartPoint(code As XElement, ParamArray expectedParts() As Action(Of Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint))) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim textPointGetter = GetStartPointFunc(codeElement) @@ -432,10 +432,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel action(textPointGetter) Next End Sub) - End Sub + End Function - Protected Sub TestGetEndPoint(code As XElement, ParamArray expectedParts() As Action(Of Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint))) - TestElement(code, + Protected Async Function TestGetEndPoint(code As XElement, ParamArray expectedParts() As Action(Of Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint))) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim textPointGetter = GetEndPointFunc(codeElement) @@ -443,18 +443,18 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel action(textPointGetter) Next End Sub) - End Sub + End Function - Protected Sub TestAccess(code As XElement, expectedAccess As EnvDTE.vsCMAccess) - TestElement(code, + Protected Async Function TestAccess(code As XElement, expectedAccess As EnvDTE.vsCMAccess) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim access = GetAccess(codeElement) Assert.Equal(expectedAccess, access) End Sub) - End Sub + End Function - Protected Sub TestAttributes(code As XElement, ParamArray expectedAttributes() As Action(Of Object)) - TestElement(code, + Protected Async Function TestAttributes(code As XElement, ParamArray expectedAttributes() As Action(Of Object)) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim attributes = GetAttributes(codeElement) Assert.Equal(expectedAttributes.Length, attributes.Count) @@ -463,10 +463,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel expectedAttributes(i - 1)(attributes.Item(i)) Next End Sub) - End Sub + End Function - Protected Sub TestBases(code As XElement, ParamArray expectedBases() As Action(Of Object)) - TestElement(code, + Protected Async Function TestBases(code As XElement, ParamArray expectedBases() As Action(Of Object)) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim bases = GetBases(codeElement) Assert.Equal(expectedBases.Length, bases.Count) @@ -475,10 +475,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel expectedBases(i - 1)(bases.Item(i)) Next End Sub) - End Sub + End Function - Protected Sub TestChildren(code As XElement, ParamArray expectedChildren() As Action(Of Object)) - TestElement(code, + Protected Async Function TestChildren(code As XElement, ParamArray expectedChildren() As Action(Of Object)) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim element = CType(codeElement, EnvDTE.CodeElement) Assert.True(element IsNot Nothing, "Could not cast " & GetType(TCodeElement).FullName & " to " & GetType(EnvDTE.CodeElement).FullName & ".") @@ -490,58 +490,58 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel expectedChildren(i - 1)(children.Item(i)) Next End Sub) - End Sub + End Function - Protected Sub TestClassKind(code As XElement, expectedClassKind As EnvDTE80.vsCMClassKind) - TestElement(code, + Protected Async Function TestClassKind(code As XElement, expectedClassKind As EnvDTE80.vsCMClassKind) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim classKind = GetClassKind(codeElement) Assert.Equal(expectedClassKind, classKind) End Sub) - End Sub + End Function - Protected Sub TestComment(code As XElement, expectedComment As String) - TestElement(code, + Protected Async Function TestComment(code As XElement, expectedComment As String) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim comment = GetComment(codeElement) Assert.Equal(expectedComment, comment) End Sub) - End Sub + End Function - Protected Sub TestConstKind(code As XElement, expectedConstKind As EnvDTE80.vsCMConstKind) - TestElement(code, + Protected Async Function TestConstKind(code As XElement, expectedConstKind As EnvDTE80.vsCMConstKind) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim constKind = GetConstKind(codeElement) Assert.Equal(expectedConstKind, constKind) End Sub) - End Sub + End Function - Protected Sub TestDataTypeKind(code As XElement, expectedDataTypeKind As EnvDTE80.vsCMDataTypeKind) - TestElement(code, + Protected Async Function TestDataTypeKind(code As XElement, expectedDataTypeKind As EnvDTE80.vsCMDataTypeKind) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim dataTypeKind = GetDataTypeKind(codeElement) Assert.Equal(expectedDataTypeKind, dataTypeKind) End Sub) - End Sub + End Function - Protected Sub TestDocComment(code As XElement, expectedDocComment As String) - TestElement(code, + Protected Async Function TestDocComment(code As XElement, expectedDocComment As String) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim docComment = GetDocComment(codeElement) Assert.Equal(expectedDocComment, docComment) End Sub) - End Sub + End Function - Protected Sub TestFullName(code As XElement, expectedFullName As String) - TestElement(code, + Protected Async Function TestFullName(code As XElement, expectedFullName As String) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim fullName = GetFullName(codeElement) Assert.Equal(expectedFullName, fullName) End Sub) - End Sub + End Function - Protected Sub TestImplementedInterfaces(code As XElement, ParamArray expectedBases() As Action(Of Object)) - TestElement(code, + Protected Async Function TestImplementedInterfaces(code As XElement, ParamArray expectedBases() As Action(Of Object)) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim implementedInterfaces = GetImplementedInterfaces(codeElement) Assert.Equal(expectedBases.Length, implementedInterfaces.Count) @@ -550,166 +550,166 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel expectedBases(i - 1)(implementedInterfaces.Item(i)) Next End Sub) - End Sub + End Function - Protected Sub TestInheritanceKind(code As XElement, expectedInheritanceKind As EnvDTE80.vsCMInheritanceKind) - TestElement(code, + Protected Async Function TestInheritanceKind(code As XElement, expectedInheritanceKind As EnvDTE80.vsCMInheritanceKind) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim inheritanceKind = GetInheritanceKind(codeElement) Assert.Equal(expectedInheritanceKind, inheritanceKind) End Sub) - End Sub + End Function - Protected Sub TestIsAbstract(code As XElement, expectedValue As Boolean) - TestElement(code, + Protected Async Function TestIsAbstract(code As XElement, expectedValue As Boolean) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim value = GetIsAbstract(codeElement) Assert.Equal(expectedValue, value) End Sub) - End Sub + End Function - Protected Sub TestIsDefault(code As XElement, expectedValue As Boolean) - TestElement(code, + Protected Async Function TestIsDefault(code As XElement, expectedValue As Boolean) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim value = GetIsDefault(codeElement) Assert.Equal(expectedValue, value) End Sub) - End Sub + End Function - Protected Sub TestIsGeneric(code As XElement, expectedValue As Boolean) - TestElement(code, + Protected Async Function TestIsGeneric(code As XElement, expectedValue As Boolean) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim value = GetIsGeneric(codeElement) Assert.Equal(expectedValue, value) End Sub) - End Sub + End Function - Protected Sub TestIsShared(code As XElement, expectedValue As Boolean) - TestElement(code, + Protected Async Function TestIsShared(code As XElement, expectedValue As Boolean) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim value = GetIsShared(codeElement) Assert.Equal(expectedValue, value) End Sub) - End Sub + End Function - Protected Sub TestKind(code As XElement, expectedKind As EnvDTE.vsCMElement) - TestElement(code, + Protected Async Function TestKind(code As XElement, expectedKind As EnvDTE.vsCMElement) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim kind = GetKind(codeElement) Assert.Equal(expectedKind, kind) End Sub) - End Sub + End Function - Protected Sub TestMustImplement(code As XElement, expectedValue As Boolean) - TestElement(code, + Protected Async Function TestMustImplement(code As XElement, expectedValue As Boolean) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim value = GetMustImplement(codeElement) Assert.Equal(expectedValue, value) End Sub) - End Sub + End Function - Protected Sub TestName(code As XElement, expectedName As String) - TestElement(code, + Protected Async Function TestName(code As XElement, expectedName As String) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim name = GetName(codeElement) Assert.Equal(expectedName, name) End Sub) - End Sub + End Function - Protected Sub TestOverrideKind(code As XElement, expectedOverrideKind As EnvDTE80.vsCMOverrideKind) - TestElement(code, + Protected Async Function TestOverrideKind(code As XElement, expectedOverrideKind As EnvDTE80.vsCMOverrideKind) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim overrideKind = GetOverrideKind(codeElement) Assert.Equal(expectedOverrideKind, overrideKind) End Sub) - End Sub + End Function - Protected Sub TestParts(code As XElement, expectedPartCount As Integer) - TestElement(code, + Protected Async Function TestParts(code As XElement, expectedPartCount As Integer) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim parts = GetParts(codeElement) ' TODO: Test the elements themselves, not just the count (PartialTypeCollection.Item is not fully implemented) Assert.Equal(expectedPartCount, parts.Count) End Sub) - End Sub + End Function - Protected Sub TestParent(code As XElement, expectedParent As Action(Of Object)) - TestElement(code, + Protected Async Function TestParent(code As XElement, expectedParent As Action(Of Object)) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim parent = GetParent(codeElement) expectedParent(parent) End Sub) - End Sub + End Function - Protected Sub TestPrototype(code As XElement, flags As EnvDTE.vsCMPrototype, expectedPrototype As String) - TestElement(code, + Protected Async Function TestPrototype(code As XElement, flags As EnvDTE.vsCMPrototype, expectedPrototype As String) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim prototype = GetPrototype(codeElement, flags) Assert.Equal(expectedPrototype, prototype) End Sub) - End Sub + End Function - Protected Sub TestPrototypeThrows(Of TException As Exception)(code As XElement, flags As EnvDTE.vsCMPrototype) - TestElement(code, + Protected Async Function TestPrototypeThrows(Of TException As Exception)(code As XElement, flags As EnvDTE.vsCMPrototype) As Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Throws(Of TException)(Sub() GetPrototype(codeElement, flags)) End Sub) - End Sub + End Function - Protected Sub TestReadWrite(code As XElement, expectedOverrideKind As EnvDTE80.vsCMPropertyKind) - TestElement(code, + Protected Async Function TestReadWrite(code As XElement, expectedOverrideKind As EnvDTE80.vsCMPropertyKind) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim readWrite = GetReadWrite(codeElement) Assert.Equal(expectedOverrideKind, readWrite) End Sub) - End Sub + End Function - Protected Sub TestIsDerivedFrom(code As XElement, baseFullName As String, expectedIsDerivedFrom As Boolean) - TestElement(code, + Protected Async Function TestIsDerivedFrom(code As XElement, baseFullName As String, expectedIsDerivedFrom As Boolean) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim actualIsDerivedFrom = IsDerivedFrom(codeElement, baseFullName) Assert.Equal(expectedIsDerivedFrom, actualIsDerivedFrom) End Sub) - End Sub + End Function - Protected Sub TestTypeProp(code As XElement, data As CodeTypeRefData) - TestElement(code, + Protected Async Function TestTypeProp(code As XElement, data As CodeTypeRefData) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim codeTypeRef = GetTypeProp(codeElement) TestCodeTypeRef(codeTypeRef, data) End Sub) - End Sub + End Function - Protected Overrides Sub TestAddAttribute(code As XElement, expectedCode As XElement, data As AttributeData) - TestElementUpdate(code, expectedCode, + Protected Overrides Async Function TestAddAttribute(code As XElement, expectedCode As XElement, data As AttributeData) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim attribute = AddAttribute(codeElement, data) Assert.NotNull(attribute) Assert.Equal(data.Name, attribute.Name) End Sub) - End Sub + End Function - Protected Overrides Sub TestAddEnumMember(code As XElement, expectedCode As XElement, data As EnumMemberData) - TestElementUpdate(code, expectedCode, + Protected Overrides Async Function TestAddEnumMember(code As XElement, expectedCode As XElement, data As EnumMemberData) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim enumMember = AddEnumMember(codeElement, data) Assert.NotNull(enumMember) Assert.Equal(data.Name, enumMember.Name) End Sub) - End Sub + End Function - Protected Overrides Sub TestAddEvent(code As XElement, expectedCode As XElement, data As EventData) - TestElementUpdate(code, expectedCode, + Protected Overrides Async Function TestAddEvent(code As XElement, expectedCode As XElement, data As EventData) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim ev = AddEvent(codeElement, data) Assert.NotNull(ev) Assert.Equal(data.Name, ev.Name) End Sub) - End Sub + End Function - Protected Overrides Sub TestAddFunction(code As XElement, expectedCode As XElement, data As FunctionData) - TestElementUpdate(code, expectedCode, + Protected Overrides Async Function TestAddFunction(code As XElement, expectedCode As XElement, data As FunctionData) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim func = AddFunction(codeElement, data) Assert.NotNull(func) @@ -718,10 +718,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Assert.Equal(data.Name, func.Name) End If End Sub) - End Sub + End Function - Protected Overrides Sub TestAddParameter(code As XElement, expectedCode As XElement, data As ParameterData) - TestElementUpdate(code, expectedCode, + Protected Overrides Async Function TestAddParameter(code As XElement, expectedCode As XElement, data As ParameterData) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim name = GetName(codeElement) @@ -733,28 +733,28 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel ' can still access the parent element after adding the parameter. Assert.Equal(name, GetName(codeElement)) End Sub) - End Sub + End Function - Protected Overrides Sub TestAddProperty(code As XElement, expectedCode As XElement, data As PropertyData) - TestElementUpdate(code, expectedCode, + Protected Overrides Async Function TestAddProperty(code As XElement, expectedCode As XElement, data As PropertyData) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim prop = AddProperty(codeElement, data) Assert.NotNull(prop) Assert.True(data.GetterName = prop.Name OrElse data.PutterName = prop.Name) End Sub) - End Sub + End Function - Protected Overrides Sub TestAddVariable(code As XElement, expectedCode As XElement, data As VariableData) - TestElementUpdate(code, expectedCode, + Protected Overrides Async Function TestAddVariable(code As XElement, expectedCode As XElement, data As VariableData) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim variable = AddVariable(codeElement, data) Assert.NotNull(variable) Assert.Equal(data.Name, variable.Name) End Sub) - End Sub + End Function - Protected Overrides Sub TestRemoveChild(code As XElement, expectedCode As XElement, child As Object) - TestElementUpdate(code, expectedCode, + Protected Overrides Async Function TestRemoveChild(code As XElement, expectedCode As XElement, child As Object) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim name = GetName(codeElement) @@ -764,295 +764,295 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel ' can still access the parent element after deleting the child. Assert.Equal(name, GetName(codeElement)) End Sub) - End Sub + End Function - Protected Sub TestSetAccess(code As XElement, expectedCode As XElement, access As EnvDTE.vsCMAccess) - TestSetAccess(code, expectedCode, access, NoThrow(Of EnvDTE.vsCMAccess)()) - End Sub + Protected Async Function TestSetAccess(code As XElement, expectedCode As XElement, access As EnvDTE.vsCMAccess) As Tasks.Task + Await TestSetAccess(code, expectedCode, access, NoThrow(Of EnvDTE.vsCMAccess)()) + End Function - Protected Sub TestSetAccess(code As XElement, expectedCode As XElement, access As EnvDTE.vsCMAccess, action As SetterAction(Of EnvDTE.vsCMAccess)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetAccess(code As XElement, expectedCode As XElement, access As EnvDTE.vsCMAccess, action As SetterAction(Of EnvDTE.vsCMAccess)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim accessSetter = GetAccessSetter(codeElement) action(access, accessSetter) End Sub) - End Sub + End Function - Protected Sub TestSetClassKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMClassKind) - TestSetClassKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMClassKind)()) - End Sub + Protected Async Function TestSetClassKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMClassKind) As Tasks.Task + Await TestSetClassKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMClassKind)()) + End Function - Protected Sub TestSetClassKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMClassKind, action As SetterAction(Of EnvDTE80.vsCMClassKind)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetClassKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMClassKind, action As SetterAction(Of EnvDTE80.vsCMClassKind)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim classKindSetter = GetClassKindSetter(codeElement) action(kind, classKindSetter) End Sub) - End Sub + End Function - Protected Sub TestSetComment(code As XElement, expectedCode As XElement, value As String) - TestSetComment(code, expectedCode, value, NoThrow(Of String)()) - End Sub + Protected Async Function TestSetComment(code As XElement, expectedCode As XElement, value As String) As Tasks.Task + Await TestSetComment(code, expectedCode, value, NoThrow(Of String)()) + End Function - Protected Sub TestSetComment(code As XElement, expectedCode As XElement, value As String, action As SetterAction(Of String)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetComment(code As XElement, expectedCode As XElement, value As String, action As SetterAction(Of String)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim commentSetter = GetCommentSetter(codeElement) action(value, commentSetter) End Sub) - End Sub + End Function - Protected Sub TestSetConstKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMConstKind) - TestSetConstKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMConstKind)()) - End Sub + Protected Async Function TestSetConstKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMConstKind) As Tasks.Task + Await TestSetConstKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMConstKind)()) + End Function - Protected Sub TestSetConstKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMConstKind, action As SetterAction(Of EnvDTE80.vsCMConstKind)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetConstKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMConstKind, action As SetterAction(Of EnvDTE80.vsCMConstKind)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim constKindSetter = GetConstKindSetter(codeElement) action(kind, constKindSetter) End Sub) - End Sub + End Function - Protected Sub TestSetDataTypeKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMDataTypeKind) - TestSetDataTypeKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMDataTypeKind)()) - End Sub + Protected Async Function TestSetDataTypeKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMDataTypeKind) As Tasks.Task + Await TestSetDataTypeKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMDataTypeKind)()) + End Function - Protected Sub TestSetDataTypeKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMDataTypeKind, action As SetterAction(Of EnvDTE80.vsCMDataTypeKind)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetDataTypeKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMDataTypeKind, action As SetterAction(Of EnvDTE80.vsCMDataTypeKind)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim dataTypeKindSetter = GetDataTypeKindSetter(codeElement) action(kind, dataTypeKindSetter) End Sub) - End Sub + End Function - Protected Sub TestSetDocComment(code As XElement, expectedCode As XElement, value As String) - TestSetDocComment(code, expectedCode, value, NoThrow(Of String)()) - End Sub + Protected Async Function TestSetDocComment(code As XElement, expectedCode As XElement, value As String) As Tasks.Task + Await TestSetDocComment(code, expectedCode, value, NoThrow(Of String)()) + End Function - Protected Sub TestSetDocComment(code As XElement, expectedCode As XElement, value As String, action As SetterAction(Of String)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetDocComment(code As XElement, expectedCode As XElement, value As String, action As SetterAction(Of String)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim docCommentSetter = GetDocCommentSetter(codeElement) action(value, docCommentSetter) End Sub) - End Sub + End Function - Protected Sub TestSetInheritanceKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMInheritanceKind) - TestSetInheritanceKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMInheritanceKind)()) - End Sub + Protected Async Function TestSetInheritanceKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMInheritanceKind) As Tasks.Task + Await TestSetInheritanceKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMInheritanceKind)()) + End Function - Protected Sub TestSetInheritanceKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMInheritanceKind, action As SetterAction(Of EnvDTE80.vsCMInheritanceKind)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetInheritanceKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMInheritanceKind, action As SetterAction(Of EnvDTE80.vsCMInheritanceKind)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim inheritanceKindSetter = GetInheritanceKindSetter(codeElement) action(kind, inheritanceKindSetter) End Sub) - End Sub + End Function - Protected Sub TestSetIsAbstract(code As XElement, expectedCode As XElement, value As Boolean) - TestSetIsAbstract(code, expectedCode, value, NoThrow(Of Boolean)()) - End Sub + Protected Async Function TestSetIsAbstract(code As XElement, expectedCode As XElement, value As Boolean) As Tasks.Task + Await TestSetIsAbstract(code, expectedCode, value, NoThrow(Of Boolean)()) + End Function - Protected Sub TestSetIsAbstract(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetIsAbstract(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim isAbstractSetter = GetIsAbstractSetter(codeElement) action(value, isAbstractSetter) End Sub) - End Sub + End Function - Protected Sub TestSetIsDefault(code As XElement, expectedCode As XElement, value As Boolean) - TestSetIsDefault(code, expectedCode, value, NoThrow(Of Boolean)()) - End Sub + Protected Async Function TestSetIsDefault(code As XElement, expectedCode As XElement, value As Boolean) As Tasks.Task + Await TestSetIsDefault(code, expectedCode, value, NoThrow(Of Boolean)()) + End Function - Protected Sub TestSetIsDefault(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetIsDefault(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim isDefaultSetter = GetIsDefaultSetter(codeElement) action(value, isDefaultSetter) End Sub) - End Sub + End Function - Protected Sub TestSetIsShared(code As XElement, expectedCode As XElement, value As Boolean) - TestSetIsShared(code, expectedCode, value, NoThrow(Of Boolean)()) - End Sub + Protected Async Function TestSetIsShared(code As XElement, expectedCode As XElement, value As Boolean) As Tasks.Task + Await TestSetIsShared(code, expectedCode, value, NoThrow(Of Boolean)()) + End Function - Protected Sub TestSetIsShared(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetIsShared(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim isSharedSetter = GetIsSharedSetter(codeElement) action(value, isSharedSetter) End Sub) - End Sub + End Function - Protected Sub TestSetMustImplement(code As XElement, expectedCode As XElement, value As Boolean) - TestSetMustImplement(code, expectedCode, value, NoThrow(Of Boolean)()) - End Sub + Protected Async Function TestSetMustImplement(code As XElement, expectedCode As XElement, value As Boolean) As Tasks.Task + Await TestSetMustImplement(code, expectedCode, value, NoThrow(Of Boolean)()) + End Function - Protected Sub TestSetMustImplement(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetMustImplement(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim mustImplementSetter = GetMustImplementSetter(codeElement) action(value, mustImplementSetter) End Sub) - End Sub + End Function - Protected Sub TestSetOverrideKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMOverrideKind) - TestSetOverrideKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMOverrideKind)()) - End Sub + Protected Async Function TestSetOverrideKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMOverrideKind) As Tasks.Task + Await TestSetOverrideKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMOverrideKind)()) + End Function - Protected Sub TestSetOverrideKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMOverrideKind, action As SetterAction(Of EnvDTE80.vsCMOverrideKind)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetOverrideKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMOverrideKind, action As SetterAction(Of EnvDTE80.vsCMOverrideKind)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim overrideKindSetter = GetOverrideKindSetter(codeElement) action(kind, overrideKindSetter) End Sub) - End Sub + End Function - Protected Sub TestSetName(code As XElement, expectedCode As XElement, name As String, action As SetterAction(Of String)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetName(code As XElement, expectedCode As XElement, name As String, action As SetterAction(Of String)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim nameSetter = GetNameSetter(codeElement) action(name, nameSetter) End Sub) - End Sub + End Function - Protected Sub TestNamespaceName(code As XElement, name As String) - TestElement(code, + Protected Async Function TestNamespaceName(code As XElement, name As String) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim codeNamespaceElement = GetNamespace(codeElement) Assert.NotNull(codeNamespaceElement) Assert.Equal(name, codeNamespaceElement.Name) End Sub) - End Sub + End Function - Protected Sub TestSetTypeProp(code As XElement, expectedCode As XElement, codeTypeRef As EnvDTE.CodeTypeRef) - TestSetTypeProp(code, expectedCode, codeTypeRef, NoThrow(Of EnvDTE.CodeTypeRef)()) - End Sub + Protected Async Function TestSetTypeProp(code As XElement, expectedCode As XElement, codeTypeRef As EnvDTE.CodeTypeRef) As Tasks.Task + Await TestSetTypeProp(code, expectedCode, codeTypeRef, NoThrow(Of EnvDTE.CodeTypeRef)()) + End Function - Protected Sub TestSetTypeProp(code As XElement, expectedCode As XElement, codeTypeRef As EnvDTE.CodeTypeRef, action As SetterAction(Of EnvDTE.CodeTypeRef)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetTypeProp(code As XElement, expectedCode As XElement, codeTypeRef As EnvDTE.CodeTypeRef, action As SetterAction(Of EnvDTE.CodeTypeRef)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim typePropSetter = GetTypePropSetter(codeElement) action(codeTypeRef, typePropSetter) End Sub) - End Sub + End Function - Protected Sub TestSetTypeProp(code As XElement, expectedCode As XElement, typeName As String) - TestSetTypeProp(code, expectedCode, typeName, NoThrow(Of EnvDTE.CodeTypeRef)()) - End Sub + Protected Async Function TestSetTypeProp(code As XElement, expectedCode As XElement, typeName As String) As Tasks.Task + Await TestSetTypeProp(code, expectedCode, typeName, NoThrow(Of EnvDTE.CodeTypeRef)()) + End Function - Protected Sub TestSetTypeProp(code As XElement, expectedCode As XElement, typeName As String, action As SetterAction(Of EnvDTE.CodeTypeRef)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetTypeProp(code As XElement, expectedCode As XElement, typeName As String, action As SetterAction(Of EnvDTE.CodeTypeRef)) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(state, codeElement) Dim codeTypeRef = state.RootCodeModel.CreateCodeTypeRef(typeName) Dim typePropSetter = GetTypePropSetter(codeElement) action(codeTypeRef, typePropSetter) End Sub) - End Sub + End Function - Protected Sub TestGenericNameExtender_GetBaseTypesCount(code As XElement, expected As Integer) - TestElement(code, + Protected Async Function TestGenericNameExtender_GetBaseTypesCount(code As XElement, expected As Integer) As Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, GenericNameExtender_GetBaseTypesCount(codeElement)) End Sub) - End Sub + End Function - Protected Sub TestGenericNameExtender_GetImplementedTypesCount(code As XElement, expected As Integer) - TestElement(code, + Protected Async Function TestGenericNameExtender_GetImplementedTypesCount(code As XElement, expected As Integer) As Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, GenericNameExtender_GetImplementedTypesCount(codeElement)) End Sub) - End Sub + End Function - Protected Sub TestGenericNameExtender_GetImplementedTypesCountThrows(Of TException As Exception)(code As XElement) - TestElement(code, + Protected Async Function TestGenericNameExtender_GetImplementedTypesCountThrows(Of TException As Exception)(code As XElement) As Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Throws(Of TException)(Sub() GenericNameExtender_GetImplementedTypesCount(codeElement)) End Sub) - End Sub + End Function - Protected Sub TestGenericNameExtender_GetBaseGenericName(code As XElement, index As Integer, expected As String) - TestElement(code, + Protected Async Function TestGenericNameExtender_GetBaseGenericName(code As XElement, index As Integer, expected As String) As Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, GenericNameExtender_GetBaseGenericName(codeElement, index)) End Sub) - End Sub + End Function - Protected Sub TestGenericNameExtender_GetImplTypeGenericName(code As XElement, index As Integer, expected As String) - TestElement(code, + Protected Async Function TestGenericNameExtender_GetImplTypeGenericName(code As XElement, index As Integer, expected As String) As Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, GenericNameExtender_GetImplTypeGenericName(codeElement, index)) End Sub) - End Sub + End Function - Protected Sub TestGenericNameExtender_GetImplTypeGenericNameThrows(Of TException As Exception)(code As XElement, index As Integer) - TestElement(code, + Protected Async Function TestGenericNameExtender_GetImplTypeGenericNameThrows(Of TException As Exception)(code As XElement, index As Integer) As Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Throws(Of TException)(Sub() GenericNameExtender_GetImplTypeGenericName(codeElement, index)) End Sub) - End Sub + End Function - Protected Sub TestAddBase(code As XElement, base As Object, position As Object, expectedCode As XElement) - TestElementUpdate(code, expectedCode, + Protected Async Function TestAddBase(code As XElement, base As Object, position As Object, expectedCode As XElement) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) AddBase(codeElement, base, position) End Sub) - End Sub + End Function - Protected Sub TestAddBaseThrows(Of TException As Exception)(code As XElement, base As Object, position As Object) - TestElement(code, + Protected Async Function TestAddBaseThrows(Of TException As Exception)(code As XElement, base As Object, position As Object) As Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Throws(Of TException)(Sub() AddBase(codeElement, base, position)) End Sub) - End Sub + End Function - Protected Sub TestRemoveBase(code As XElement, element As Object, expectedCode As XElement) - TestElementUpdate(code, expectedCode, + Protected Async Function TestRemoveBase(code As XElement, element As Object, expectedCode As XElement) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) RemoveBase(codeElement, element) End Sub) - End Sub + End Function - Protected Sub TestRemoveBaseThrows(Of TException As Exception)(code As XElement, element As Object) - TestElement(code, + Protected Async Function TestRemoveBaseThrows(Of TException As Exception)(code As XElement, element As Object) As Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Throws(Of TException)(Sub() RemoveBase(codeElement, element)) End Sub) - End Sub + End Function - Protected Sub TestAddImplementedInterface(code As XElement, base As Object, position As Object, expectedCode As XElement) - TestElementUpdate(code, expectedCode, + Protected Async Function TestAddImplementedInterface(code As XElement, base As Object, position As Object, expectedCode As XElement) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) AddImplementedInterface(codeElement, base, position) End Sub) - End Sub + End Function - Protected Sub TestAddImplementedInterfaceThrows(Of TException As Exception)(code As XElement, base As Object, position As Object) - TestElement(code, + Protected Async Function TestAddImplementedInterfaceThrows(Of TException As Exception)(code As XElement, base As Object, position As Object) As Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Throws(Of TException)(Sub() AddImplementedInterface(codeElement, base, position)) End Sub) - End Sub + End Function - Protected Sub TestRemoveImplementedInterface(code As XElement, element As Object, expectedCode As XElement) - TestElementUpdate(code, expectedCode, + Protected Async Function TestRemoveImplementedInterface(code As XElement, element As Object, expectedCode As XElement) As Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) RemoveImplementedInterface(codeElement, element) End Sub) - End Sub + End Function - Protected Sub TestRemoveImplementedInterfaceThrows(Of TException As Exception)(code As XElement, element As Object) - TestElement(code, + Protected Async Function TestRemoveImplementedInterfaceThrows(Of TException As Exception)(code As XElement, element As Object) As Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Throws(Of TException)(Sub() RemoveImplementedInterface(codeElement, element)) End Sub) - End Sub + End Function - Protected Sub TestAllParameterNames(code As XElement, ParamArray expectedParameterNames() As String) - TestElement(code, + Protected Async Function TestAllParameterNames(code As XElement, ParamArray expectedParameterNames() As String) As Tasks.Task + Await TestElement(code, Sub(codeElement) Dim parameters = GetParameters(codeElement) Assert.NotNull(parameters) @@ -1063,7 +1063,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel TestAllParameterNamesByName(parameters, expectedParameterNames) End If End Sub) - End Sub + End Function Private Sub TestAllParameterNamesByName(parameters As EnvDTE.CodeElements, expectedParameterNames() As String) For index = 0 To expectedParameterNames.Count() - 1 diff --git a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeEventTests.vb b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeEventTests.vb index 557247d58d38d99cdc76413fa0a71cb86fc5053d..aad4f3b044e0b61ffc9abddb8a0719224b6e152d 100644 --- a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeEventTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeEventTests.vb @@ -72,12 +72,12 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Return codeElement.AddAttribute(data.Name, data.Value, data.Position) End Function - Protected Sub TestIsPropertyStyleEvent(code As XElement, expected As Boolean) - TestElement(code, + Protected Async Function TestIsPropertyStyleEvent(code As XElement, expected As Boolean) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, codeElement.IsPropertyStyleEvent) End Sub) - End Sub + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeFunctionTests.vb b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeFunctionTests.vb index ea624a87f58d286bbd3dc5aa955f5023114b084c..bca37c6f91e2ef9d0c04639cdcf48152768a82e6 100644 --- a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeFunctionTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeFunctionTests.vb @@ -130,34 +130,34 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Throw New NotSupportedException End Function - Protected Sub TestCanOverride(code As XElement, expected As Boolean) - TestElement(code, + Protected Async Function TestCanOverride(code As XElement, expected As Boolean) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, codeElement.CanOverride) End Sub) - End Sub + End Function - Protected Sub TestSetCanOverride(code As XElement, expectedCode As XElement, value As Boolean) - TestSetCanOverride(code, expectedCode, value, NoThrow(Of Boolean)()) - End Sub + Protected Async Function TestSetCanOverride(code As XElement, expectedCode As XElement, value As Boolean) As Threading.Tasks.Task + Await TestSetCanOverride(code, expectedCode, value, NoThrow(Of Boolean)()) + End Function - Protected Sub TestSetCanOverride(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetCanOverride(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) As Threading.Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) action(value, Sub(v) codeElement.CanOverride = v) End Sub) - End Sub + End Function - Protected Sub TestIsOverloaded(code As XElement, expectedOverloaded As Boolean) - TestElement(code, + Protected Async Function TestIsOverloaded(code As XElement, expectedOverloaded As Boolean) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Dim overloaded = GetIsOverloaded(codeElement) Assert.Equal(expectedOverloaded, overloaded) End Sub) - End Sub + End Function - Protected Sub TestOverloadsUniqueSignatures(code As XElement, ParamArray expectedOverloadNames As String()) - TestElement(code, + Protected Async Function TestOverloadsUniqueSignatures(code As XElement, ParamArray expectedOverloadNames As String()) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Dim actualOverloads = GetOverloads(codeElement) Assert.Equal(expectedOverloadNames.Count, actualOverloads.Count) @@ -167,49 +167,49 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Assert.True(expectedOverloadNames.Contains(signature)) Next End Sub) - End Sub + End Function - Protected Sub TestFunctionKind(code As XElement, expected As EnvDTE.vsCMFunction) - TestElement(code, + Protected Async Function TestFunctionKind(code As XElement, expected As EnvDTE.vsCMFunction) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, codeElement.FunctionKind) End Sub) - End Sub + End Function - Protected Sub TestFunctionKind(code As XElement, expected As EnvDTE80.vsCMFunction2) - TestElement(code, + Protected Async Function TestFunctionKind(code As XElement, expected As EnvDTE80.vsCMFunction2) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, CType(codeElement.FunctionKind, EnvDTE80.vsCMFunction2)) End Sub) - End Sub + End Function - Protected Sub TestExtensionMethodExtender_IsExtension(code As XElement, expected As Boolean) - TestElement(code, + Protected Async Function TestExtensionMethodExtender_IsExtension(code As XElement, expected As Boolean) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, ExtensionMethodExtender_GetIsExtension(codeElement)) End Sub) - End Sub + End Function - Protected Sub TestPartialMethodExtender_IsPartial(code As XElement, expected As Boolean) - TestElement(code, + Protected Async Function TestPartialMethodExtender_IsPartial(code As XElement, expected As Boolean) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, PartialMethodExtender_GetIsPartial(codeElement)) End Sub) - End Sub + End Function - Protected Sub TestPartialMethodExtender_IsDeclaration(code As XElement, expected As Boolean) - TestElement(code, + Protected Async Function TestPartialMethodExtender_IsDeclaration(code As XElement, expected As Boolean) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, PartialMethodExtender_GetIsDeclaration(codeElement)) End Sub) - End Sub + End Function - Protected Sub TestPartialMethodExtender_HasOtherPart(code As XElement, expected As Boolean) - TestElement(code, + Protected Async Function TestPartialMethodExtender_HasOtherPart(code As XElement, expected As Boolean) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, PartialMethodExtender_GetHasOtherPart(codeElement)) End Sub) - End Sub + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeImportTests.vb b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeImportTests.vb index 57afb2c42f144e5abd8b5a37b27d4db2dc9f2c78..154f40766f9d9a63779dc039c4025ab1e9811b82 100644 --- a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeImportTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeImportTests.vb @@ -36,12 +36,12 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Return Sub(value) codeElement.Name = value End Function - Protected Sub TestNamespace(code As XElement, expectedNamespace As String) - TestElement(code, + Protected Async Function TestNamespace(code As XElement, expectedNamespace As String) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expectedNamespace, codeElement.Namespace) End Sub) - End Sub + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeModelObjectTests.vb b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeModelObjectTests.vb index f65a1ffb3bfe47e0711d71d87597fd03a6185cfb..3d7e0419ff5a5a0b05fc9b3250171ef55e15be66 100644 --- a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeModelObjectTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeModelObjectTests.vb @@ -13,65 +13,65 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel End Function - Protected Overridable Sub TestAddAttribute(code As XElement, expectedCode As XElement, data As AttributeData) + Protected Overridable Function TestAddAttribute(code As XElement, expectedCode As XElement, data As AttributeData) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function - Protected Overridable Sub TestAddClass(code As XElement, expectedCode As XElement, data As ClassData) + Protected Overridable Function TestAddClass(code As XElement, expectedCode As XElement, data As ClassData) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function - Protected Overridable Sub TestAddDelegate(code As XElement, expectedCode As XElement, data As DelegateData) + Protected Overridable Function TestAddDelegate(code As XElement, expectedCode As XElement, data As DelegateData) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function - Protected Overridable Sub TestAddEnum(code As XElement, expectedCode As XElement, data As EnumData) + Protected Overridable Function TestAddEnum(code As XElement, expectedCode As XElement, data As EnumData) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function - Protected Overridable Sub TestAddEnumMember(code As XElement, expectedCode As XElement, data As EnumMemberData) + Protected Overridable Function TestAddEnumMember(code As XElement, expectedCode As XElement, data As EnumMemberData) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function - Protected Overridable Sub TestAddEvent(code As XElement, expectedCode As XElement, data As EventData) + Protected Overridable Function TestAddEvent(code As XElement, expectedCode As XElement, data As EventData) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function - Protected Overridable Sub TestAddFunction(code As XElement, expectedCode As XElement, data As FunctionData) + Protected Overridable Function TestAddFunction(code As XElement, expectedCode As XElement, data As FunctionData) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function - Protected Overridable Sub TestAddImport(code As XElement, expectedCode As XElement, data As ImportData) + Protected Overridable Function TestAddImport(code As XElement, expectedCode As XElement, data As ImportData) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function - Protected Overridable Sub TestAddInterface(code As XElement, expectedCode As XElement, data As InterfaceData) + Protected Overridable Function TestAddInterface(code As XElement, expectedCode As XElement, data As InterfaceData) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function - Protected Overridable Sub TestAddNamespace(code As XElement, expectedCode As XElement, data As NamespaceData) + Protected Overridable Function TestAddNamespace(code As XElement, expectedCode As XElement, data As NamespaceData) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function - Protected Overridable Sub TestAddParameter(code As XElement, expectedCode As XElement, data As ParameterData) + Protected Overridable Function TestAddParameter(code As XElement, expectedCode As XElement, data As ParameterData) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function - Protected Overridable Sub TestAddProperty(code As XElement, expectedCode As XElement, data As PropertyData) + Protected Overridable Function TestAddProperty(code As XElement, expectedCode As XElement, data As PropertyData) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function - Protected Overridable Sub TestAddStruct(code As XElement, expectedCode As XElement, data As StructData) + Protected Overridable Function TestAddStruct(code As XElement, expectedCode As XElement, data As StructData) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function - Protected Overridable Sub TestAddVariable(code As XElement, expectedCode As XElement, data As VariableData) + Protected Overridable Function TestAddVariable(code As XElement, expectedCode As XElement, data As VariableData) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function - Protected Overridable Sub TestRemoveChild(code As XElement, expectedCode As XElement, child As Object) + Protected Overridable Function TestRemoveChild(code As XElement, expectedCode As XElement, child As Object) As Threading.Tasks.Task Throw New NotImplementedException - End Sub + End Function Protected Sub TestCodeTypeRef(codeTypeRef As EnvDTE.CodeTypeRef, data As CodeTypeRefData) Assert.NotNull(codeTypeRef) diff --git a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeParameterTests.vb b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeParameterTests.vb index 17293d7fd1fb185f47d3b5f844c28ca6b86c1b7b..181ae85288e34c4045d04be083b2c6b6fccbbe1c 100644 --- a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeParameterTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeParameterTests.vb @@ -64,42 +64,42 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Return codeElement.AddAttribute(data.Name, data.Value, data.Position) End Function - Protected Sub TestParameterKind(code As XElement, kind As vsCMParameterKind) - TestElement(code, + Protected Async Function TestParameterKind(code As XElement, kind As vsCMParameterKind) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(kind, codeElement.ParameterKind) End Sub) - End Sub + End Function - Protected Sub TestDefaultValue(code As XElement, expectedValue As String) - TestElement(code, + Protected Async Function TestDefaultValue(code As XElement, expectedValue As String) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expectedValue, codeElement.DefaultValue) End Sub) - End Sub + End Function - Protected Sub TestSetParameterKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMParameterKind) - TestSetParameterKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMParameterKind)()) - End Sub + Protected Async Function TestSetParameterKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMParameterKind) As Threading.Tasks.Task + Await TestSetParameterKind(code, expectedCode, kind, NoThrow(Of EnvDTE80.vsCMParameterKind)()) + End Function - Protected Sub TestSetParameterKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMParameterKind, action As SetterAction(Of EnvDTE80.vsCMParameterKind)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetParameterKind(code As XElement, expectedCode As XElement, kind As EnvDTE80.vsCMParameterKind, action As SetterAction(Of EnvDTE80.vsCMParameterKind)) As Threading.Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim parameterKindSetter = GetParameterKindSetter(codeElement) action(kind, parameterKindSetter) End Sub) - End Sub + End Function - Protected Sub TestSetDefaultValue(code As XElement, expected As XElement, defaultValue As String) - TestSetDefaultValue(code, expected, defaultValue, NoThrow(Of String)()) - End Sub + Protected Async Function TestSetDefaultValue(code As XElement, expected As XElement, defaultValue As String) As Threading.Tasks.Task + Await TestSetDefaultValue(code, expected, defaultValue, NoThrow(Of String)()) + End Function - Protected Sub TestSetDefaultValue(code As XElement, expectedCode As XElement, defaultValue As String, action As SetterAction(Of String)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetDefaultValue(code As XElement, expectedCode As XElement, defaultValue As String, action As SetterAction(Of String)) As Threading.Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) Dim defaultValueSetter = GetDefaultValueSetter(codeElement) action(defaultValue, defaultValueSetter) End Sub) - End Sub + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/AbstractCodePropertyTests.vb b/src/VisualStudio/Core/Test/CodeModel/AbstractCodePropertyTests.vb index d44d0ccbddc43f15c5bdc812e1b33f4ff210fde5..a12a1f87dd6a113f4ef58027833a92d18872c6b8 100644 --- a/src/VisualStudio/Core/Test/CodeModel/AbstractCodePropertyTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/AbstractCodePropertyTests.vb @@ -100,26 +100,26 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Throw New NotSupportedException End Function - Protected Sub TestAutoImplementedPropertyExtender_IsAutoImplemented(code As XElement, expected As Boolean) - TestElement(code, + Protected Async Function TestAutoImplementedPropertyExtender_IsAutoImplemented(code As XElement, expected As Boolean) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, AutoImplementedPropertyExtender_GetIsAutoImplemented(codeElement)) End Sub) - End Sub + End Function - Protected Sub TestGetter(code As XElement, verifier As Action(Of EnvDTE.CodeFunction)) - TestElement(code, + Protected Async Function TestGetter(code As XElement, verifier As Action(Of EnvDTE.CodeFunction)) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) verifier(codeElement.Getter) End Sub) - End Sub + End Function - Protected Sub TestSetter(code As XElement, verifier As Action(Of EnvDTE.CodeFunction)) - TestElement(code, + Protected Async Function TestSetter(code As XElement, verifier As Action(Of EnvDTE.CodeFunction)) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) verifier(codeElement.Setter) End Sub) - End Sub + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeVariableTests.vb b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeVariableTests.vb index 99effd9c1d142ae2c2460e37efc2379c67061b3f..4eda0688c2dee3d178f5d5a847cdc77391f3711e 100644 --- a/src/VisualStudio/Core/Test/CodeModel/AbstractCodeVariableTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/AbstractCodeVariableTests.vb @@ -94,41 +94,41 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Return Sub(value) codeElement.Type = value End Function - Protected Sub TestIsConstant(code As XElement, expected As Boolean) - TestElement(code, + Protected Async Function TestIsConstant(code As XElement, expected As Boolean) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, codeElement.IsConstant) End Sub) - End Sub + End Function - Protected Sub TestSetIsConstant(code As XElement, expectedCode As XElement, value As Boolean) - TestSetIsConstant(code, expectedCode, value, NoThrow(Of Boolean)()) - End Sub + Protected Async Function TestSetIsConstant(code As XElement, expectedCode As XElement, value As Boolean) As Threading.Tasks.Task + Await TestSetIsConstant(code, expectedCode, value, NoThrow(Of Boolean)()) + End Function - Protected Sub TestSetIsConstant(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetIsConstant(code As XElement, expectedCode As XElement, value As Boolean, action As SetterAction(Of Boolean)) As Threading.Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) action(value, Sub(v) codeElement.IsConstant = v) End Sub) - End Sub + End Function - Protected Sub TestInitExpression(code As XElement, expected As Object) - TestElement(code, + Protected Async Function TestInitExpression(code As XElement, expected As Object) As Threading.Tasks.Task + Await TestElement(code, Sub(codeElement) Assert.Equal(expected, codeElement.InitExpression) End Sub) - End Sub + End Function - Protected Sub TestSetInitExpression(code As XElement, expectedCode As XElement, value As Object) - TestSetInitExpression(code, expectedCode, value, NoThrow(Of Object)()) - End Sub + Protected Async Function TestSetInitExpression(code As XElement, expectedCode As XElement, value As Object) As Threading.Tasks.Task + Await TestSetInitExpression(code, expectedCode, value, NoThrow(Of Object)()) + End Function - Protected Sub TestSetInitExpression(code As XElement, expectedCode As XElement, value As Object, action As SetterAction(Of Object)) - TestElementUpdate(code, expectedCode, + Protected Async Function TestSetInitExpression(code As XElement, expectedCode As XElement, value As Object, action As SetterAction(Of Object)) As Threading.Tasks.Task + Await TestElementUpdate(code, expectedCode, Sub(codeElement) action(value, Sub(v) codeElement.InitExpression = v) End Sub) - End Sub + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/AbstractEventCollectorTests.vb b/src/VisualStudio/Core/Test/CodeModel/AbstractEventCollectorTests.vb index dae4ab2da7a0de025dc9f5914fc54bbfe790acea..900d02d58f810451d454b8c7dc3fcac02aef34f1 100644 --- a/src/VisualStudio/Core/Test/CodeModel/AbstractEventCollectorTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/AbstractEventCollectorTests.vb @@ -85,7 +85,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel End If End Sub - Friend Sub Test(code As XElement, change As XElement, ParamArray expectedEvents As Action(Of CodeModelEvent, ICodeModelService)()) + Friend Async Function TestAsync(code As XElement, change As XElement, ParamArray expectedEvents As Action(Of CodeModelEvent, ICodeModelService)()) As Threading.Tasks.Task Dim definition = CommonReferences="true"> @@ -94,7 +94,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel - Using workspace = TestWorkspaceFactory.CreateWorkspace(definition, exportProvider:=VisualStudioTestExportProvider.ExportProvider) + Using workspace = Await TestWorkspaceFactory.CreateWorkspaceAsync(definition, exportProvider:=VisualStudioTestExportProvider.ExportProvider) Dim project = workspace.CurrentSolution.Projects.First() Dim codeModelService = project.LanguageServices.GetService(Of ICodeModelService)() Assert.NotNull(codeModelService) @@ -114,7 +114,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel expectedEvent(collectedEvent, codeModelService) Next End Using - End Sub + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/AbstractFileCodeModelTests.vb b/src/VisualStudio/Core/Test/CodeModel/AbstractFileCodeModelTests.vb index 41b03ab3d76dc63941f0826037fd42664432dca1..1b79a14ea2b06c73b70aa3a798eb10b2eb965b4c 100644 --- a/src/VisualStudio/Core/Test/CodeModel/AbstractFileCodeModelTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/AbstractFileCodeModelTests.vb @@ -7,8 +7,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Public MustInherit Class AbstractFileCodeModelTests Inherits AbstractCodeModelObjectTests(Of EnvDTE80.FileCodeModel2) - Protected Sub TestOperation(code As XElement, expectedCode As XElement, operation As Action(Of EnvDTE80.FileCodeModel2)) - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Protected Async Function TestOperation(code As XElement, expectedCode As XElement, operation As Action(Of EnvDTE80.FileCodeModel2)) As Tasks.Task + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim fileCodeModel = state.FileCodeModel Assert.NotNull(fileCodeModel) @@ -19,7 +19,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Assert.Equal(expectedCode.NormalizedValue.Trim(), text.Trim()) End Using - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim fileCodeModel = state.FileCodeModel Assert.NotNull(fileCodeModel) @@ -31,17 +31,17 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Assert.Equal(expectedCode.NormalizedValue.Trim(), text.Trim()) End Using - End Sub + End Function - Protected Sub TestOperation(code As XElement, operation As Action(Of EnvDTE80.FileCodeModel2)) - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Protected Async Function TestOperation(code As XElement, operation As Action(Of EnvDTE80.FileCodeModel2)) As Tasks.Task + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim fileCodeModel = state.FileCodeModel Assert.NotNull(fileCodeModel) operation(fileCodeModel) End Using - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim fileCodeModel = state.FileCodeModel Assert.NotNull(fileCodeModel) @@ -49,56 +49,56 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel operation(fileCodeModel) fileCodeModel.EndBatch() End Using - End Sub + End Function - Protected Overrides Sub TestAddAttribute(code As XElement, expectedCode As XElement, data As AttributeData) - TestOperation(code, expectedCode, + Protected Overrides Async Function TestAddAttribute(code As XElement, expectedCode As XElement, data As AttributeData) As Tasks.Task + Await TestOperation(code, expectedCode, Sub(fileCodeModel) Dim newAttribute = fileCodeModel.AddAttribute(data.Name, data.Value, data.Position) Assert.NotNull(newAttribute) Assert.Equal(data.Name, newAttribute.Name) End Sub) - End Sub + End Function - Protected Overrides Sub TestAddClass(code As XElement, expectedCode As XElement, data As ClassData) - TestOperation(code, expectedCode, + Protected Overrides Async Function TestAddClass(code As XElement, expectedCode As XElement, data As ClassData) As Tasks.Task + Await TestOperation(code, expectedCode, Sub(fileCodeModel) Dim newClass = fileCodeModel.AddClass(data.Name, data.Position, data.Bases, data.ImplementedInterfaces, data.Access) Assert.NotNull(newClass) Assert.Equal(data.Name, newClass.Name) End Sub) - End Sub + End Function - Protected Overrides Sub TestAddDelegate(code As XElement, expectedCode As XElement, data As DelegateData) - TestOperation(code, expectedCode, + Protected Overrides Async Function TestAddDelegate(code As XElement, expectedCode As XElement, data As DelegateData) As Tasks.Task + Await TestOperation(code, expectedCode, Sub(fileCodeModel) Dim newDelegate = fileCodeModel.AddDelegate(data.Name, data.Type, data.Position, data.Access) Assert.NotNull(newDelegate) Assert.Equal(data.Name, newDelegate.Name) End Sub) - End Sub + End Function - Protected Overrides Sub TestAddEnum(code As XElement, expectedCode As XElement, data As EnumData) - TestOperation(code, expectedCode, + Protected Overrides Async Function TestAddEnum(code As XElement, expectedCode As XElement, data As EnumData) As Tasks.Task + Await TestOperation(code, expectedCode, Sub(fileCodeModel) Dim newEnum = fileCodeModel.AddEnum(data.Name, data.Position, data.Base, data.Access) Assert.NotNull(newEnum) Assert.Equal(data.Name, newEnum.Name) End Sub) - End Sub + End Function - Protected Overrides Sub TestAddFunction(code As XElement, expectedCode As XElement, data As FunctionData) - TestOperation(code, expectedCode, + Protected Overrides Async Function TestAddFunction(code As XElement, expectedCode As XElement, data As FunctionData) As Tasks.Task + Await TestOperation(code, expectedCode, Sub(fileCodeModel) Assert.Throws(Of System.Runtime.InteropServices.COMException)( Sub() fileCodeModel.AddFunction(data.Name, data.Kind, data.Type, data.Position, data.Access) End Sub) End Sub) - End Sub + End Function - Protected Overrides Sub TestAddImport(code As XElement, expectedCode As XElement, data As ImportData) - TestOperation(code, expectedCode, + Protected Overrides Async Function TestAddImport(code As XElement, expectedCode As XElement, data As ImportData) As Tasks.Task + Await TestOperation(code, expectedCode, Sub(fileCodeModel) Dim newImport = fileCodeModel.AddImport(data.Namespace, data.Position, data.Alias) Assert.NotNull(newImport) @@ -108,51 +108,51 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Assert.Equal(data.Alias, newImport.Alias) End If End Sub) - End Sub + End Function - Protected Overrides Sub TestAddInterface(code As XElement, expectedCode As XElement, data As InterfaceData) - TestOperation(code, expectedCode, + Protected Overrides Async Function TestAddInterface(code As XElement, expectedCode As XElement, data As InterfaceData) As Tasks.Task + Await TestOperation(code, expectedCode, Sub(fileCodeModel) Dim newInterface = fileCodeModel.AddInterface(data.Name, data.Position, data.Bases, data.Access) Assert.NotNull(newInterface) Assert.Equal(data.Name, newInterface.Name) End Sub) - End Sub + End Function - Protected Overrides Sub TestAddNamespace(code As XElement, expectedCode As XElement, data As NamespaceData) - TestOperation(code, expectedCode, + Protected Overrides Async Function TestAddNamespace(code As XElement, expectedCode As XElement, data As NamespaceData) As Tasks.Task + Await TestOperation(code, expectedCode, Sub(fileCodeModel) Dim newNamespace = fileCodeModel.AddNamespace(data.Name, data.Position) Assert.NotNull(newNamespace) Assert.Equal(data.Name, newNamespace.Name) End Sub) - End Sub + End Function - Protected Overrides Sub TestAddStruct(code As XElement, expectedCode As XElement, data As StructData) - TestOperation(code, expectedCode, + Protected Overrides Async Function TestAddStruct(code As XElement, expectedCode As XElement, data As StructData) As Tasks.Task + Await TestOperation(code, expectedCode, Sub(fileCodeModel) Dim newStruct = fileCodeModel.AddStruct(data.Name, data.Position, data.Bases, data.ImplementedInterfaces, data.Access) Assert.NotNull(newStruct) Assert.Equal(data.Name, newStruct.Name) End Sub) - End Sub + End Function - Protected Overrides Sub TestAddVariable(code As XElement, expectedCode As XElement, data As VariableData) - TestOperation(code, expectedCode, + Protected Overrides Async Function TestAddVariable(code As XElement, expectedCode As XElement, data As VariableData) As Tasks.Task + Await TestOperation(code, expectedCode, Sub(fileCodeModel) Assert.Throws(Of System.Runtime.InteropServices.COMException)( Sub() fileCodeModel.AddVariable(data.Name, data.Type, data.Position, data.Access) End Sub) End Sub) - End Sub + End Function - Protected Overrides Sub TestRemoveChild(code As XElement, expectedCode As XElement, element As Object) - TestOperation(code, expectedCode, + Protected Overrides Async Function TestRemoveChild(code As XElement, expectedCode As XElement, element As Object) As Tasks.Task + Await TestOperation(code, expectedCode, Sub(fileCodeModel) fileCodeModel.Remove(element) End Sub) - End Sub + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/AbstractRootCodeModelTests.vb b/src/VisualStudio/Core/Test/CodeModel/AbstractRootCodeModelTests.vb index 40b378a8d3c23d45e53a07f5aa0a94a888060571..f2523e6c4047b0a1c96a24316c4d948e04375968 100644 --- a/src/VisualStudio/Core/Test/CodeModel/AbstractRootCodeModelTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/AbstractRootCodeModelTests.vb @@ -4,26 +4,26 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Public MustInherit Class AbstractRootCodeModelTests Inherits AbstractCodeModelObjectTests(Of EnvDTE80.CodeModel2) - Protected Sub TestRootCodeModel(workspaceDefinition As XElement, action As Action(Of EnvDTE80.CodeModel2)) - Using state = CreateCodeModelTestState(workspaceDefinition) + Protected Async Function TestRootCodeModel(workspaceDefinition As XElement, action As Action(Of EnvDTE80.CodeModel2)) As Threading.Tasks.Task + Using state = Await CreateCodeModelTestStateAsync(workspaceDefinition) Dim rootCodeModel = TryCast(state.RootCodeModel, EnvDTE80.CodeModel2) Assert.NotNull(rootCodeModel) action(rootCodeModel) End Using - End Sub + End Function - Protected Sub TestRootCodeModelWithCodeFile(code As XElement, action As Action(Of EnvDTE80.CodeModel2)) - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Protected Async Function TestRootCodeModelWithCodeFile(code As XElement, action As Action(Of EnvDTE80.CodeModel2)) As Threading.Tasks.Task + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim rootCodeModel = TryCast(state.RootCodeModel, EnvDTE80.CodeModel2) Assert.NotNull(rootCodeModel) action(rootCodeModel) End Using - End Sub + End Function - Protected Sub TestCodeElements(code As XElement, ParamArray expectedChildren() As Action(Of Object)) - TestRootCodeModelWithCodeFile(code, + Protected Async Function TestCodeElements(code As XElement, ParamArray expectedChildren() As Action(Of Object)) As Threading.Tasks.Task + Await TestRootCodeModelWithCodeFile(code, Sub(rootCodeModel) Dim codeElements = rootCodeModel.CodeElements Assert.Equal(expectedChildren.Length, rootCodeModel.CodeElements.Count) @@ -32,10 +32,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel expectedChildren(i - 1)(codeElements.Item(i)) Next End Sub) - End Sub + End Function - Protected Sub TestCodeElements(code As XElement, ParamArray names() As String) - TestRootCodeModelWithCodeFile(code, + Protected Async Function TestCodeElements(code As XElement, ParamArray names() As String) As Threading.Tasks.Task + Await TestRootCodeModelWithCodeFile(code, Sub(rootCodeModel) Assert.Equal(names.Length, rootCodeModel.CodeElements.Count) @@ -45,41 +45,41 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Assert.Contains(names(i), actualNames) Next End Sub) - End Sub + End Function - Protected Sub TestCreateCodeTypeRef(type As Object, data As CodeTypeRefData) - TestCreateCodeTypeRef(, type, data) - End Sub + Protected Async Function TestCreateCodeTypeRef(type As Object, data As CodeTypeRefData) As Threading.Tasks.Task + Await TestCreateCodeTypeRef(, type, data) + End Function - Protected Sub TestCreateCodeTypeRef(code As XElement, type As Object, data As CodeTypeRefData) - TestRootCodeModelWithCodeFile(code, + Protected Async Function TestCreateCodeTypeRef(code As XElement, type As Object, data As CodeTypeRefData) As Threading.Tasks.Task + Await TestRootCodeModelWithCodeFile(code, Sub(rootCodeModel) Dim codeTypeRef = rootCodeModel.CreateCodeTypeRef(type) TestCodeTypeRef(codeTypeRef, data) End Sub) - End Sub + End Function - Protected Sub TestCreateCodeTypeRefThrows(Of TException As Exception)(type As Object) - TestCreateCodeTypeRef(Of TException)(, type) - End Sub + Protected Async Function TestCreateCodeTypeRefThrows(Of TException As Exception)(type As Object) As Threading.Tasks.Task + Await TestCreateCodeTypeRef(Of TException)(, type) + End Function - Protected Sub TestCreateCodeTypeRef(Of TException As Exception)(code As XElement, type As Object) - TestRootCodeModelWithCodeFile(code, + Protected Async Function TestCreateCodeTypeRef(Of TException As Exception)(code As XElement, type As Object) As Threading.Tasks.Task + Await TestRootCodeModelWithCodeFile(code, Sub(rootCodeModel) Assert.Throws(Of TException)( Sub() rootCodeModel.CreateCodeTypeRef(type) End Sub) End Sub) - End Sub + End Function - Protected Sub TestCodeTypeFromFullName(workspaceDefinition As XElement, fullName As String, action As Action(Of EnvDTE.CodeType)) - TestRootCodeModel(workspaceDefinition, + Protected Async Function TestCodeTypeFromFullName(workspaceDefinition As XElement, fullName As String, action As Action(Of EnvDTE.CodeType)) As Threading.Tasks.Task + Await TestRootCodeModel(workspaceDefinition, Sub(rootCodeModel) action(rootCodeModel.CodeTypeFromFullName(fullName)) End Sub) - End Sub + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeAccessorFunctionTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeAccessorFunctionTests.vb index f154ceea0792b69597e1ac8c6aaf873ee91c05f8..4274a2a56a9df42d2db6c0d9e18b54d137a7f594 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeAccessorFunctionTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeAccessorFunctionTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,7 +11,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "Access tests" - Public Sub Access1() + Public Async Function TestAccess1() As Task Dim code = class C @@ -28,11 +29,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access2() + Public Async Function TestAccess2() As Task Dim code = class C @@ -50,13 +51,13 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function #End Region - Public Sub TypeDescriptor_GetProperties() + Public Async Function TestTypeDescriptor_GetProperties() As Task Dim code = class C @@ -72,8 +73,8 @@ class C "IsShared", "MustImplement", "Overloads", "Attributes", "DocComment", "Comment", "CanOverride", "OverrideKind", "IsGeneric"} - TestPropertyDescriptors(code, expectedPropertyNames) - End Sub + Await TestPropertyDescriptors(code, expectedPropertyNames) + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeAttributeTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeAttributeTests.vb index 7a5c54918186acf711eb2204149567a337236ab1..15daab7e8e1fe300f96e1103eb04948bb2e772cd 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeAttributeTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeAttributeTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,7 +11,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "GetStartPoint() tests" - Public Sub GetStartPoint1() + Public Async Function TestGetStartPoint1() As Task Dim code = using System; @@ -18,7 +19,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp class C { } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -40,10 +41,10 @@ class C { } Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=2, absoluteOffset:=17, lineLength:=14))) - End Sub + End Function - Public Sub GetStartPoint2() + Public Async Function TestGetStartPoint2() As Task Dim code = using System; @@ -51,7 +52,7 @@ class C { } class C { } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -73,7 +74,7 @@ class C { } Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=2, absoluteOffset:=17, lineLength:=20))) - End Sub + End Function #End Region @@ -81,7 +82,7 @@ class C { } #Region "GetEndPoint() tests" - Public Sub GetEndPoint1() + Public Async Function TestGetEndPoint1() As Task Dim code = using System; @@ -89,7 +90,7 @@ class C { } class C { } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -111,10 +112,10 @@ class C { } Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=14, absoluteOffset:=29, lineLength:=14))) - End Sub + End Function - Public Sub GetEndPoint2() + Public Async Function TestGetEndPoint2() As Task Dim code = using System; @@ -122,7 +123,7 @@ class C { } class C { } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -144,14 +145,14 @@ class C { } Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=20, absoluteOffset:=35, lineLength:=20))) - End Sub + End Function #End Region #Region "AttributeArgument GetStartPoint() tests" - Public Sub GetAttributeArgumentStartPoint1() + Public Async Function TestGetAttributeArgumentStartPoint1() As Task Dim code = using System; @@ -166,7 +167,7 @@ class FooAttribute : Attribute } - TestAttributeArgumentStartPoint(code, 1, + Await TestAttributeArgumentStartPoint(code, 1, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -187,10 +188,10 @@ class FooAttribute : Attribute ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=16, absoluteOffset:=31, lineLength:=33))) - End Sub + End Function - Public Sub GetAttributeArgumentStartPoint2() + Public Async Function TestGetAttributeArgumentStartPoint2() As Task Dim code = using System; @@ -205,7 +206,7 @@ class FooAttribute : Attribute } - TestAttributeArgumentStartPoint(code, 2, + Await TestAttributeArgumentStartPoint(code, 2, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -226,10 +227,10 @@ class FooAttribute : Attribute ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=19, absoluteOffset:=34, lineLength:=33))) - End Sub + End Function - Public Sub GetAttributeArgumentStartPoint3() + Public Async Function TestGetAttributeArgumentStartPoint3() As Task Dim code = using System; @@ -244,7 +245,7 @@ class FooAttribute : Attribute } - TestAttributeArgumentStartPoint(code, 3, + Await TestAttributeArgumentStartPoint(code, 3, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -265,14 +266,14 @@ class FooAttribute : Attribute ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=26, absoluteOffset:=41, lineLength:=33))) - End Sub + End Function #End Region #Region "AttributeArgument GetEndPoint() tests" - Public Sub GetAttributeArgumentEndPoint1() + Public Async Function TestGetAttributeArgumentEndPoint1() As Task Dim code = using System; @@ -288,7 +289,7 @@ class FooAttribute : Attribute End Class - TestAttributeArgumentEndPoint(code, 1, + Await TestAttributeArgumentEndPoint(code, 1, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -309,10 +310,10 @@ End Class ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=17, absoluteOffset:=32, lineLength:=33))) - End Sub + End Function - Public Sub GetAttributeArgumentEndPoint2() + Public Async Function TestGetAttributeArgumentEndPoint2() As Task Dim code = using System; @@ -328,7 +329,7 @@ class FooAttribute : Attribute End Class - TestAttributeArgumentEndPoint(code, 2, + Await TestAttributeArgumentEndPoint(code, 2, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -349,10 +350,10 @@ End Class ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=24, absoluteOffset:=39, lineLength:=33))) - End Sub + End Function - Public Sub GetAttributeArgumentEndPoint3() + Public Async Function TestGetAttributeArgumentEndPoint3() As Task Dim code = using System; @@ -368,7 +369,7 @@ class FooAttribute : Attribute End Class - TestAttributeArgumentEndPoint(code, 3, + Await TestAttributeArgumentEndPoint(code, 3, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -389,13 +390,13 @@ End Class ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=32, absoluteOffset:=47, lineLength:=33))) - End Sub + End Function #End Region #Region "FullName tests" - Public Sub GetFullName1() + Public Async Function TestGetFullName1() As Task Dim code = using System; @@ -404,25 +405,25 @@ using System; class C { } - TestFullName(code, "System.SerializableAttribute") - End Sub + Await TestFullName(code, "System.SerializableAttribute") + End Function - Public Sub GetFullName2() + Public Async Function TestGetFullName2() As Task Dim code = [$$System.Serializable] class C { } - TestFullName(code, "System.SerializableAttribute") - End Sub + Await TestFullName(code, "System.SerializableAttribute") + End Function #End Region #Region "Parent tests" - Public Sub GetParent1() + Public Async Function TestGetParent1() As Task Dim code = using System; @@ -431,11 +432,11 @@ using System; class C { } - TestParent(code, IsElement("C", kind:=EnvDTE.vsCMElement.vsCMElementClass)) - End Sub + Await TestParent(code, IsElement("C", kind:=EnvDTE.vsCMElement.vsCMElementClass)) + End Function - Public Sub GetParent2() + Public Async Function TestGetParent2() As Task Dim code = using System; @@ -444,13 +445,13 @@ using System; class C { } - TestParent(code, IsElement("C", kind:=EnvDTE.vsCMElement.vsCMElementClass)) - End Sub + Await TestParent(code, IsElement("C", kind:=EnvDTE.vsCMElement.vsCMElementClass)) + End Function #End Region #Region "Attribute argument tests" - Public Sub GetArguments1() + Public Async Function TestGetArguments1() As Task Dim code = using System; @@ -459,11 +460,11 @@ using System; class C { } - TestAttributeArguments(code, NoElements) - End Sub + Await TestAttributeArguments(code, NoElements) + End Function - Public Sub GetArguments2() + Public Async Function TestGetArguments2() As Task Dim code = using System; @@ -472,11 +473,11 @@ using System; class C { } - TestAttributeArguments(code, NoElements) - End Sub + Await TestAttributeArguments(code, NoElements) + End Function - Public Sub GetArguments3() + Public Async Function TestGetArguments3() As Task Dim code = using System; @@ -485,11 +486,11 @@ using System; class C { } - TestAttributeArguments(code, IsAttributeArgument(value:="true")) - End Sub + Await TestAttributeArguments(code, IsAttributeArgument(value:="true")) + End Function - Public Sub GetArguments4() + Public Async Function TestGetArguments4() As Task Dim code = using System; @@ -498,14 +499,14 @@ using System; class CAttribute : Attribute { } - TestAttributeArguments(code, IsAttributeArgument(value:="AttributeTargets.All"), IsAttributeArgument(name:="AllowMultiple", value:="false")) + Await TestAttributeArguments(code, IsAttributeArgument(value:="AttributeTargets.All"), IsAttributeArgument(name:="AllowMultiple", value:="false")) - End Sub + End Function #End Region #Region "Target tests" - Public Sub GetTarget1() + Public Async Function TestGetTarget1() As Task Dim code = using System; @@ -514,13 +515,13 @@ using System; class C { } - TestTarget(code, "type") - End Sub + Await TestTarget(code, "type") + End Function #End Region #Region "Value tests" - Public Sub GetValue1() + Public Async Function TestGetValue1() As Task Dim code = using System; @@ -529,11 +530,11 @@ using System; class C { } - TestValue(code, "") - End Sub + Await TestValue(code, "") + End Function - Public Sub GetValue2() + Public Async Function TestGetValue2() As Task Dim code = using System; @@ -542,11 +543,11 @@ using System; class C { } - TestValue(code, "") - End Sub + Await TestValue(code, "") + End Function - Public Sub GetValue3() + Public Async Function TestGetValue3() As Task Dim code = using System; @@ -555,12 +556,12 @@ using System; class C { } - TestValue(code, "false") + Await TestValue(code, "false") - End Sub + End Function - Public Sub GetValue4() + Public Async Function TestGetValue4() As Task Dim code = using System; @@ -569,13 +570,13 @@ using System; class CAttribute : Attribute { } - TestValue(code, "AttributeTargets.All, AllowMultiple=false") - End Sub + Await TestValue(code, "AttributeTargets.All, AllowMultiple=false") + End Function #End Region #Region "AddAttributeArgument tests" - Public Sub AddAttributeArgument1() + Public Async Function TestAddAttributeArgument1() As Task Dim code = using System; @@ -592,12 +593,12 @@ using System; class C { } - TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Value = "true"}) + Await TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Value = "true"}) - End Sub + End Function - Public Sub AddAttributeArgument2() + Public Async Function TestAddAttributeArgument2() As Task Dim code = using System; @@ -614,12 +615,12 @@ using System; class C { } - TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Value = "true"}) + Await TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Value = "true"}) - End Sub + End Function - Public Sub AddAttributeArgument3() + Public Async Function TestAddAttributeArgument3() As Task Dim code = using System; @@ -636,12 +637,12 @@ using System; class CAttribute : Attribute { } - TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Name = "AllowMultiple", .Value = "false", .Position = 1}) + Await TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Name = "AllowMultiple", .Value = "false", .Position = 1}) - End Sub + End Function - Public Sub AddAttributeArgumentStress() + Public Async Function TestAddAttributeArgumentStress() As Task Dim code = [$$A] @@ -650,21 +651,21 @@ class C } - TestElement(code, + Await TestElement(code, Sub(codeAttribute) For i = 1 To 100 Dim value = i.ToString() Dim codeAttributeArgument = codeAttribute.AddArgument(value, Position:=1) Next End Sub) - End Sub + End Function #End Region #Region "Delete tests" - Public Sub Delete1() + Public Async Function TestDelete1() As Task Dim code = [$$Foo] @@ -680,11 +681,11 @@ class C } - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function - Public Sub Delete2() + Public Async Function TestDelete2() As Task Dim code = [$$Foo, Bar] @@ -697,11 +698,11 @@ class C { } class C { } - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function - Public Sub Delete3() + Public Async Function TestDelete3() As Task Dim code = [Foo] @@ -715,11 +716,11 @@ class C { } class C { } - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function - Public Sub Delete4() + Public Async Function TestDelete4() As Task Dim code = [assembly: $$Foo] @@ -729,11 +730,11 @@ class C { } - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function - Public Sub Delete5() + Public Async Function TestDelete5() As Task Dim code = [assembly: $$Foo, Bar] @@ -744,11 +745,11 @@ class C { } [assembly: Bar] - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function - Public Sub Delete6() + Public Async Function TestDelete6() As Task Dim code = [assembly: Foo] @@ -760,11 +761,11 @@ class C { } [assembly: Foo] - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function - Public Sub Delete7() + Public Async Function TestDelete7() As Task Dim code = @@ -782,11 +783,11 @@ class C { } class C { } ]]> - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function - Public Sub Delete8() + Public Async Function TestDelete8() As Task Dim code = - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function #End Region #Region "Delete attribute argument tests" - Public Sub DeleteAttributeArgument1() + Public Async Function TestDeleteAttributeArgument1() As Task Dim code = [$$System.CLSCompliant(true)] @@ -819,11 +820,11 @@ class C { } class C { } - TestDeleteAttributeArgument(code, expected, 1) - End Sub + Await TestDeleteAttributeArgument(code, expected, 1) + End Function - Public Sub DeleteAttributeArgument2() + Public Async Function TestDeleteAttributeArgument2() As Task Dim code = [$$AttributeUsage(AttributeTargets.All, AllowMultiple = false)] @@ -836,11 +837,11 @@ class CAttribute : Attribute { } class CAttribute : Attribute { } - TestDeleteAttributeArgument(code, expected, 1) - End Sub + Await TestDeleteAttributeArgument(code, expected, 1) + End Function - Public Sub DeleteAttributeArgument3() + Public Async Function TestDeleteAttributeArgument3() As Task Dim code = [$$AttributeUsage(AttributeTargets.All, AllowMultiple = false)] @@ -853,14 +854,14 @@ class CAttribute : Attribute { } class CAttribute : Attribute { } - TestDeleteAttributeArgument(code, expected, 2) - End Sub + Await TestDeleteAttributeArgument(code, expected, 2) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = [$$Foo] @@ -873,13 +874,13 @@ class C { } class C { } - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region #Region "Set Target tests" - Public Sub SetTarget1() + Public Async Function TestSetTarget1() As Task Dim code = using System; @@ -896,11 +897,11 @@ using System; class C { } - TestSetTarget(code, expected, "assembly") - End Sub + Await TestSetTarget(code, expected, "assembly") + End Function - Public Sub SetTarget2() + Public Async Function TestSetTarget2() As Task Dim code = using System; @@ -917,11 +918,11 @@ using System; class C { } - TestSetTarget(code, expected, "assembly") - End Sub + Await TestSetTarget(code, expected, "assembly") + End Function - Public Sub SetTarget3() + Public Async Function TestSetTarget3() As Task Dim code = using System; @@ -938,13 +939,13 @@ using System; class C { } - TestSetTarget(code, expected, "") - End Sub + Await TestSetTarget(code, expected, "") + End Function #End Region #Region "Set Value tests" - Public Sub SetValue1() + Public Async Function TestSetValue1() As Task Dim code = using System; @@ -961,11 +962,11 @@ using System; class C { } - TestSetValue(code, expected, "true") - End Sub + Await TestSetValue(code, expected, "true") + End Function - Public Sub SetValue2() + Public Async Function TestSetValue2() As Task Dim code = using System; @@ -982,11 +983,11 @@ using System; class C { } - TestSetValue(code, expected, "true") - End Sub + Await TestSetValue(code, expected, "true") + End Function - Public Sub SetValue3() + Public Async Function TestSetValue3() As Task Dim code = using System; @@ -1003,11 +1004,11 @@ using System; class C { } - TestSetValue(code, expected, "true") - End Sub + Await TestSetValue(code, expected, "true") + End Function - Public Sub SetValue4() + Public Async Function TestSetValue4() As Task Dim code = using System; @@ -1024,12 +1025,12 @@ using System; class C { } - TestSetValue(code, expected, "") - End Sub + Await TestSetValue(code, expected, "") + End Function #End Region - Public Sub TypeDescriptor_GetProperties() + Public Async Function TestTypeDescriptor_GetProperties() As Task Dim code = [$$System.CLSCompliant(true)] @@ -1043,8 +1044,8 @@ class C "InfoLocation", "Children", "Language", "StartPoint", "EndPoint", "ExtenderNames", "ExtenderCATID", "Parent", "Value", "Target", "Arguments"} - TestPropertyDescriptors(code, expectedPropertyNames) - End Sub + Await TestPropertyDescriptors(code, expectedPropertyNames) + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeClassTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeClassTests.vb index 7394eae72a7d44a00b9ab202ee54566f196ec7d3..6d6722b23958900e3563723cb372b88e42a84062 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeClassTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeClassTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,13 +11,13 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "GetStartPoint() tests" - Public Sub GetStartPoint1() + Public Async Function TestGetStartPoint1() As Task Dim code = class $$C {} - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -37,16 +38,16 @@ class $$C {} ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=10))) - End Sub + End Function - Public Sub GetStartPoint2() + Public Async Function TestGetStartPoint2() As Task Dim code = class $$C { } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -67,16 +68,16 @@ class $$C { } ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=11))) - End Sub + End Function - Public Sub GetStartPoint3() + Public Async Function TestGetStartPoint3() As Task Dim code = class $$C { } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -97,17 +98,17 @@ class $$C { } ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=12))) - End Sub + End Function - Public Sub GetStartPoint4() + Public Async Function TestGetStartPoint4() As Task Dim code = using System; [CLSCompliant(true)] class $$C { } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -128,10 +129,10 @@ using System; ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=1, absoluteOffset:=15, lineLength:=32))) - End Sub + End Function - Public Sub GetStartPoint5() + Public Async Function TestGetStartPoint5() As Task Dim code = using System; @@ -139,7 +140,7 @@ using System; class $$C { } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -160,10 +161,10 @@ class $$C { } ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=1, absoluteOffset:=15, lineLength:=20))) - End Sub + End Function - Public Sub GetStartPoint6() + Public Async Function TestGetStartPoint6() As Task Dim code = using System; @@ -172,7 +173,7 @@ class $$C { } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -193,10 +194,10 @@ class $$C { ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=1, absoluteOffset:=15, lineLength:=20))) - End Sub + End Function - Public Sub GetStartPoint7() + Public Async Function TestGetStartPoint7() As Task Dim code = using System; @@ -206,7 +207,7 @@ class $$C { } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -227,10 +228,10 @@ class $$C { ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=1, absoluteOffset:=15, lineLength:=20))) - End Sub + End Function - Public Sub GetStartPoint8() + Public Async Function TestGetStartPoint8() As Task Dim code = using System; @@ -241,7 +242,7 @@ class $$C } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -262,17 +263,17 @@ class $$C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=1, absoluteOffset:=15, lineLength:=20))) - End Sub + End Function - Public Sub GetStartPoint9() + Public Async Function TestGetStartPoint9() As Task Dim code = using System; [CLSCompliant(true)] class $$C {void M() { }} - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -293,17 +294,17 @@ class $$C {void M() { }} ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=1, absoluteOffset:=15, lineLength:=20))) - End Sub + End Function - Public Sub GetStartPoint10() + Public Async Function TestGetStartPoint10() As Task Dim code = using System; [CLSCompliant(true)] class $$C { void M() { } } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -324,10 +325,10 @@ class $$C { void M() { } } ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=1, absoluteOffset:=15, lineLength:=20))) - End Sub + End Function - Public Sub GetStartPoint11() + Public Async Function TestGetStartPoint11() As Task Dim code = using System; @@ -336,7 +337,7 @@ class $$C { void M() { } } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -357,10 +358,10 @@ class $$C { ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=1, absoluteOffset:=15, lineLength:=20))) - End Sub + End Function - Public Sub GetStartPoint12() + Public Async Function TestGetStartPoint12() As Task Dim code = using System; @@ -370,7 +371,7 @@ class $$C void M() { } } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -391,20 +392,20 @@ class $$C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=1, absoluteOffset:=15, lineLength:=20))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint1() + Public Async Function TestGetEndPoint1() As Task Dim code = class $$C {} - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -425,16 +426,16 @@ class $$C {} ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=11, absoluteOffset:=11, lineLength:=10))) - End Sub + End Function - Public Sub GetEndPoint2() + Public Async Function TestGetEndPoint2() As Task Dim code = class $$C { } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -455,16 +456,16 @@ class $$C { } ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=12, absoluteOffset:=12, lineLength:=11))) - End Sub + End Function - Public Sub GetEndPoint3() + Public Async Function TestGetEndPoint3() As Task Dim code = class $$C { } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -485,17 +486,17 @@ class $$C { } ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=13, absoluteOffset:=13, lineLength:=12))) - End Sub + End Function - Public Sub GetEndPoint4() + Public Async Function TestGetEndPoint4() As Task Dim code = using System; [CLSCompliant(true)] class $$C { } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -516,10 +517,10 @@ using System; ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=33, absoluteOffset:=47, lineLength:=32))) - End Sub + End Function - Public Sub GetEndPoint5() + Public Async Function TestGetEndPoint5() As Task Dim code = using System; @@ -527,7 +528,7 @@ using System; class $$C { } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -548,10 +549,10 @@ class $$C { } ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=12, absoluteOffset:=47, lineLength:=11))) - End Sub + End Function - Public Sub GetEndPoint6() + Public Async Function TestGetEndPoint6() As Task Dim code = using System; @@ -560,7 +561,7 @@ class $$C { } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -581,10 +582,10 @@ class $$C { ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=4, lineOffset:=2, absoluteOffset:=47, lineLength:=1))) - End Sub + End Function - Public Sub GetEndPoint7() + Public Async Function TestGetEndPoint7() As Task Dim code = using System; @@ -594,7 +595,7 @@ class $$C { } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -615,10 +616,10 @@ class $$C { ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=5, lineOffset:=2, absoluteOffset:=48, lineLength:=1))) - End Sub + End Function - Public Sub GetEndPoint8() + Public Async Function TestGetEndPoint8() As Task Dim code = using System; @@ -629,7 +630,7 @@ class $$C } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -650,17 +651,17 @@ class $$C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=6, lineOffset:=2, absoluteOffset:=48, lineLength:=1))) - End Sub + End Function - Public Sub GetEndPoint9() + Public Async Function TestGetEndPoint9() As Task Dim code = using System; [CLSCompliant(true)] class $$C {void M() { }} - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -681,17 +682,17 @@ class $$C {void M() { }} ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=23, absoluteOffset:=58, lineLength:=22))) - End Sub + End Function - Public Sub GetEndPoint10() + Public Async Function TestGetEndPoint10() As Task Dim code = using System; [CLSCompliant(true)] class $$C { void M() { } } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -712,10 +713,10 @@ class $$C { void M() { } } ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=25, absoluteOffset:=60, lineLength:=24))) - End Sub + End Function - Public Sub GetEndPoint11() + Public Async Function TestGetEndPoint11() As Task Dim code = using System; @@ -724,7 +725,7 @@ class $$C { void M() { } } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -745,10 +746,10 @@ class $$C { ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=5, lineOffset:=2, absoluteOffset:=64, lineLength:=1))) - End Sub + End Function - Public Sub GetEndPoint12() + Public Async Function TestGetEndPoint12() As Task Dim code = using System; @@ -758,7 +759,7 @@ class $$C void M() { } } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -779,118 +780,118 @@ class $$C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=6, lineOffset:=2, absoluteOffset:=64, lineLength:=1))) - End Sub + End Function #End Region #Region "Access tests" - Public Sub Access1() + Public Async Function TestAccess1() As Task Dim code = class $$C { } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access2() + Public Async Function TestAccess2() As Task Dim code = internal class $$C { } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access3() + Public Async Function TestAccess3() As Task Dim code = public class $$C { } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access4() + Public Async Function TestAccess4() As Task Dim code = class C { class $$D { } } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access5() + Public Async Function TestAccess5() As Task Dim code = class C { private class $$D { } } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access6() + Public Async Function TestAccess6() As Task Dim code = class C { protected class $$D { } } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) + End Function - Public Sub Access7() + Public Async Function TestAccess7() As Task Dim code = class C { protected internal class $$D { } } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub Access8() + Public Async Function TestAccess8() As Task Dim code = class C { internal class $$D { } } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access9() + Public Async Function TestAccess9() As Task Dim code = class C { public class $$D { } } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function #End Region #Region "Attributes tests" - Public Sub Attributes1() + Public Async Function TestAttributes1() As Task Dim code = class $$C { } - TestAttributes(code, NoElements) - End Sub + Await TestAttributes(code, NoElements) + End Function - Public Sub Attributes2() + Public Async Function TestAttributes2() As Task Dim code = using System; @@ -899,11 +900,11 @@ using System; class $$C { } - TestAttributes(code, IsElement("Serializable")) - End Sub + Await TestAttributes(code, IsElement("Serializable")) + End Function - Public Sub Attributes3() + Public Async Function TestAttributes3() As Task Dim code = using System; @@ -912,11 +913,11 @@ class $$C { } class $$C { } - TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) - End Sub + Await TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) + End Function - Public Sub Attributes4() + Public Async Function TestAttributes4() As Task Dim code = using System; @@ -924,98 +925,98 @@ class $$C { } class $$C { } - TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) - End Sub + Await TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) + End Function #End Region #Region "Bases tests" - Public Sub Bases1() + Public Async Function TestBases1() As Task Dim code = class $$C { } - TestBases(code, IsElement("Object")) - End Sub + Await TestBases(code, IsElement("Object")) + End Function - Public Sub Bases2() + Public Async Function TestBases2() As Task Dim code = class $$C : object { } - TestBases(code, IsElement("Object")) - End Sub + Await TestBases(code, IsElement("Object")) + End Function - Public Sub Bases3() + Public Async Function TestBases3() As Task Dim code = class C { } class $$D : C { } - TestBases(code, IsElement("C")) - End Sub + Await TestBases(code, IsElement("C")) + End Function - Public Sub Bases4() + Public Async Function TestBases4() As Task Dim code = interface I { } class $$D : I { } - TestBases(code, IsElement("Object")) - End Sub + Await TestBases(code, IsElement("Object")) + End Function - Public Sub Bases5() + Public Async Function TestBases5() As Task Dim code = class $$C : System.Collections.Generic.List<int> { } - TestBases(code, IsElement("List")) - End Sub + Await TestBases(code, IsElement("List")) + End Function #End Region #Region "Children tests" - Public Sub Children1() + Public Async Function TestChildren1() As Task Dim code = class $$C { } - TestChildren(code, NoElements) - End Sub + Await TestChildren(code, NoElements) + End Function - Public Sub Children2() + Public Async Function TestChildren2() As Task Dim code = class $$C { void M() { } } - TestChildren(code, IsElement("M")) - End Sub + Await TestChildren(code, IsElement("M")) + End Function - Public Sub Children3() + Public Async Function TestChildren3() As Task Dim code = [Obsolete] class $$C { void M() { } } - TestChildren(code, IsElement("Obsolete"), IsElement("M")) - End Sub + Await TestChildren(code, IsElement("Obsolete"), IsElement("M")) + End Function #End Region @@ -1023,7 +1024,7 @@ class $$C { void M() { } } #Region "ClassKind tests" - Public Sub ClassKind_MainClass() + Public Async Function TestClassKind_MainClass() As Task Dim code = class $$C @@ -1031,11 +1032,11 @@ class $$C } - TestClassKind(code, EnvDTE80.vsCMClassKind.vsCMClassKindMainClass) - End Sub + Await TestClassKind(code, EnvDTE80.vsCMClassKind.vsCMClassKindMainClass) + End Function - Public Sub ClassKind_PartialClass() + Public Async Function TestClassKind_PartialClass() As Task Dim code = partial class $$C @@ -1043,25 +1044,25 @@ partial class $$C } - TestClassKind(code, EnvDTE80.vsCMClassKind.vsCMClassKindPartialClass) - End Sub + Await TestClassKind(code, EnvDTE80.vsCMClassKind.vsCMClassKindPartialClass) + End Function #End Region #Region "Comment tests" - Public Sub Comment1() + Public Async Function TestComment1() As Task Dim code = class $$C { } - TestComment(code, String.Empty) - End Sub + Await TestComment(code, String.Empty) + End Function - Public Sub Comment2() + Public Async Function TestComment2() As Task Dim code = // Foo @@ -1069,11 +1070,11 @@ class $$C { } class $$C { } - TestComment(code, "Foo" & vbCrLf & "Bar" & vbCrLf) - End Sub + Await TestComment(code, "Foo" & vbCrLf & "Bar" & vbCrLf) + End Function - Public Sub Comment3() + Public Async Function TestComment3() As Task Dim code = class B { } // Foo @@ -1081,11 +1082,11 @@ class B { } // Foo class $$C { } - TestComment(code, "Bar" & vbCrLf) - End Sub + Await TestComment(code, "Bar" & vbCrLf) + End Function - Public Sub Comment4() + Public Async Function TestComment4() As Task Dim code = class B { } // Foo @@ -1093,11 +1094,11 @@ class B { } // Foo class $$C { } - TestComment(code, "Bar" & vbCrLf) - End Sub + Await TestComment(code, "Bar" & vbCrLf) + End Function - Public Sub Comment5() + Public Async Function TestComment5() As Task Dim code = class B { } // Foo @@ -1107,11 +1108,11 @@ class B { } // Foo class $$C { } - TestComment(code, "Bar" & vbCrLf) - End Sub + Await TestComment(code, "Bar" & vbCrLf) + End Function - Public Sub Comment6() + Public Async Function TestComment6() As Task Dim code = class B { } // Foo @@ -1122,11 +1123,11 @@ class B { } // Foo class $$C { } - TestComment(code, "Hello" & vbCrLf & "World!" & vbCrLf) - End Sub + Await TestComment(code, "Hello" & vbCrLf & "World!" & vbCrLf) + End Function - Public Sub Comment7() + Public Async Function TestComment7() As Task Dim code = class B { } // Foo @@ -1138,11 +1139,11 @@ class B { } // Foo class $$C { } - TestComment(code, "Hello" & vbCrLf & vbCrLf & "World!" & vbCrLf) - End Sub + Await TestComment(code, "Hello" & vbCrLf & vbCrLf & "World!" & vbCrLf) + End Function - Public Sub Comment8() + Public Async Function TestComment8() As Task Dim code = /* This @@ -1154,11 +1155,11 @@ class $$C { } class $$C { } - TestComment(code, "This" & vbCrLf & "is" & vbCrLf & "a" & vbCrLf & "multi-line" & vbCrLf & "comment!" & vbCrLf) - End Sub + Await TestComment(code, "This" & vbCrLf & "is" & vbCrLf & "a" & vbCrLf & "multi-line" & vbCrLf & "comment!" & vbCrLf) + End Function - Public Sub Comment9() + Public Async Function TestComment9() As Task Dim code = // Foo @@ -1166,26 +1167,26 @@ class $$C { } class $$C { } - TestComment(code, String.Empty) - End Sub + Await TestComment(code, String.Empty) + End Function #End Region #Region "DocComment tests" - Public Sub DocComment1() + Public Async Function TestDocComment1() As Task Dim code = /// <summary>Hello World</summary> class $$C { } - TestDocComment(code, "" & vbCrLf & "Hello World" & vbCrLf & "") - End Sub + Await TestDocComment(code, "" & vbCrLf & "Hello World" & vbCrLf & "") + End Function - Public Sub DocComment2() + Public Async Function TestDocComment2() As Task Dim code = /// <summary> @@ -1194,11 +1195,11 @@ class $$C { } class $$C { } - TestDocComment(code, "" & vbCrLf & "" & vbCrLf & "Hello World" & vbCrLf & "" & vbCrLf & "") - End Sub + Await TestDocComment(code, "" & vbCrLf & "" & vbCrLf & "Hello World" & vbCrLf & "" & vbCrLf & "") + End Function - Public Sub DocComment3() + Public Async Function TestDocComment3() As Task Dim code = /// <summary> @@ -1207,11 +1208,11 @@ class $$C { } class $$C { } - TestDocComment(code, "" & vbCrLf & " " & vbCrLf & " Hello World" & vbCrLf & "" & vbCrLf & "") - End Sub + Await TestDocComment(code, "" & vbCrLf & " " & vbCrLf & " Hello World" & vbCrLf & "" & vbCrLf & "") + End Function - Public Sub DocComment4() + Public Async Function TestDocComment4() As Task Dim code = /// <summary> @@ -1221,15 +1222,15 @@ class $$C { } class $$C { } - TestDocComment(code, "" & vbCrLf & "" & vbCrLf & "Summary" & vbCrLf & "" & vbCrLf & "Remarks" & vbCrLf & "") - End Sub + Await TestDocComment(code, "" & vbCrLf & "" & vbCrLf & "Summary" & vbCrLf & "" & vbCrLf & "Remarks" & vbCrLf & "") + End Function #End Region #Region "InheritanceKind tests" - Public Sub InheritanceKind_None() + Public Async Function TestInheritanceKind_None() As Task Dim code = class $$C @@ -1237,11 +1238,11 @@ class $$C } - TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNone) - End Sub + Await TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNone) + End Function - Public Sub InheritanceKind_Abstract() + Public Async Function TestInheritanceKind_Abstract() As Task Dim code = abstract class $$C @@ -1249,11 +1250,11 @@ abstract class $$C } - TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract) - End Sub + Await TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract) + End Function - Public Sub InheritanceKind_Sealed() + Public Async Function TestInheritanceKind_Sealed() As Task Dim code = sealed class $$C @@ -1261,11 +1262,11 @@ sealed class $$C } - TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindSealed) - End Sub + Await TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindSealed) + End Function - Public Sub InheritanceKind_New() + Public Async Function TestInheritanceKind_New() As Task Dim code = class C @@ -1279,11 +1280,11 @@ class D } - TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) - End Sub + Await TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) + End Function - Public Sub InheritanceKind_AbstractAndNew() + Public Async Function TestInheritanceKind_AbstractAndNew() As Task Dim code = class C @@ -1297,15 +1298,15 @@ class D } - TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) - End Sub + Await TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) + End Function #End Region #Region "IsAbstract tests" - Public Sub IsAbstract1() + Public Async Function TestIsAbstract1() As Task Dim code = class $$C @@ -1313,11 +1314,11 @@ class $$C } - TestIsAbstract(code, False) - End Sub + Await TestIsAbstract(code, False) + End Function - Public Sub IsAbstract2() + Public Async Function TestIsAbstract2() As Task Dim code = abstract class $$C @@ -1325,11 +1326,11 @@ abstract class $$C } - TestIsAbstract(code, True) - End Sub + Await TestIsAbstract(code, True) + End Function - Public Sub IsAbstract3() + Public Async Function TestIsAbstract3() As Task Dim code = abstract partial class $$C @@ -1341,11 +1342,11 @@ partial class C } - TestIsAbstract(code, True) - End Sub + Await TestIsAbstract(code, True) + End Function - Public Sub IsAbstract4() + Public Async Function TestIsAbstract4() As Task Dim code = partial class $$C @@ -1357,15 +1358,15 @@ abstract partial class C } - TestIsAbstract(code, False) - End Sub + Await TestIsAbstract(code, False) + End Function #End Region #Region "IsShared tests" - Public Sub IsShared1() + Public Async Function TestIsShared1() As Task Dim code = class $$C @@ -1373,11 +1374,11 @@ class $$C } - TestIsShared(code, False) - End Sub + Await TestIsShared(code, False) + End Function - Public Sub IsShared2() + Public Async Function TestIsShared2() As Task Dim code = static class $$C @@ -1385,11 +1386,11 @@ static class $$C } - TestIsShared(code, True) - End Sub + Await TestIsShared(code, True) + End Function - Public Sub IsShared3() + Public Async Function TestIsShared3() As Task Dim code = static partial class $$C @@ -1401,11 +1402,11 @@ partial class C } - TestIsShared(code, True) - End Sub + Await TestIsShared(code, True) + End Function - Public Sub IsShared4() + Public Async Function TestIsShared4() As Task Dim code = partial class $$C @@ -1417,66 +1418,66 @@ static partial class C } - TestIsShared(code, False) - End Sub + Await TestIsShared(code, False) + End Function #End Region #Region "IsDerivedFrom tests" - Public Sub IsDerivedFromObject_Explicit() + Public Async Function TestIsDerivedFromObject_Explicit() As Task Dim code = class $$C : object { } - TestIsDerivedFrom(code, "System.Object", True) - End Sub + Await TestIsDerivedFrom(code, "System.Object", True) + End Function - Public Sub IsDerivedFrom_ObjectImplicit() + Public Async Function TestIsDerivedFrom_ObjectImplicit() As Task Dim code = class $$C { } - TestIsDerivedFrom(code, "System.Object", True) - End Sub + Await TestIsDerivedFrom(code, "System.Object", True) + End Function - Public Sub IsDerivedFrom_NotString() + Public Async Function TestIsDerivedFrom_NotString() As Task Dim code = class $$C { } - TestIsDerivedFrom(code, "System.String", False) - End Sub + Await TestIsDerivedFrom(code, "System.String", False) + End Function - Public Sub IsDerivedFrom_NotNonexistent() + Public Async Function TestIsDerivedFrom_NotNonexistent() As Task Dim code = class $$C { } - TestIsDerivedFrom(code, "System.ThisIsClearlyNotARealClassName", False) - End Sub + Await TestIsDerivedFrom(code, "System.ThisIsClearlyNotARealClassName", False) + End Function - Public Sub IsDerivedFrom_UserClassInGlobalNamespace() + Public Async Function TestIsDerivedFrom_UserClassInGlobalNamespace() As Task Dim code = class B { } class $$C : B { } - TestIsDerivedFrom(code, "B", True) - End Sub + Await TestIsDerivedFrom(code, "B", True) + End Function - Public Sub IsDerivedFrom_UserClassInSameNamespace() + Public Async Function TestIsDerivedFrom_UserClassInSameNamespace() As Task Dim code = namespace NS @@ -1486,11 +1487,11 @@ namespace NS } - TestIsDerivedFrom(code, "NS.B", True) - End Sub + Await TestIsDerivedFrom(code, "NS.B", True) + End Function - Public Sub IsDerivedFrom_UserClassInDifferentNamespace() + Public Async Function TestIsDerivedFrom_UserClassInDifferentNamespace() As Task Dim code = namespace NS1 @@ -1504,14 +1505,14 @@ namespace NS2 } - TestIsDerivedFrom(code, "NS1.B", True) - End Sub + Await TestIsDerivedFrom(code, "NS1.B", True) + End Function #End Region #Region "Kind tests" - Public Sub Kind() + Public Async Function TestKind1() As Task Dim code = class $$C @@ -1519,13 +1520,13 @@ class $$C } - TestKind(code, EnvDTE.vsCMElement.vsCMElementClass) - End Sub + Await TestKind(code, EnvDTE.vsCMElement.vsCMElementClass) + End Function #End Region #Region "Parts tests" - Public Sub Parts1() + Public Async Function TestParts1() As Task Dim code = class $$C @@ -1533,11 +1534,11 @@ class $$C } - TestParts(code, 1) - End Sub + Await TestParts(code, 1) + End Function - Public Sub Parts2() + Public Async Function TestParts2() As Task Dim code = partial class $$C @@ -1545,11 +1546,11 @@ partial class $$C } - TestParts(code, 1) - End Sub + Await TestParts(code, 1) + End Function - Public Sub Parts3() + Public Async Function TestParts3() As Task Dim code = partial class $$C @@ -1561,14 +1562,14 @@ partial class C } - TestParts(code, 2) - End Sub + Await TestParts(code, 2) + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = using System; @@ -1583,11 +1584,11 @@ using System; [Serializable()] class C { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = using System; @@ -1604,12 +1605,12 @@ using System; [CLSCompliant(true)] class C { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment1() + Public Async Function TestAddAttribute_BelowDocComment1() As Task Dim code = using System; @@ -1626,12 +1627,12 @@ using System; [CLSCompliant(true)] class C { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) + End Function - Public Sub AddAttribute_BelowDocComment2() + Public Async Function TestAddAttribute_BelowDocComment2() As Task Dim code = using System; @@ -1650,12 +1651,12 @@ using System; [Serializable] class C { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) + End Function - Public Sub AddAttribute_BelowDocComment3() + Public Async Function TestAddAttribute_BelowDocComment3() As Task Dim code = using System; @@ -1674,15 +1675,15 @@ using System; [CLSCompliant(true)] class C { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) + End Function #End Region #Region "AddBase tests" - Public Sub AddBase1() + Public Async Function TestAddBase1() As Task Dim code = class $$C { } @@ -1692,11 +1693,11 @@ class $$C { } class C : B { } - TestAddBase(code, "B", Nothing, expected) - End Sub + Await TestAddBase(code, "B", Nothing, expected) + End Function - Public Sub AddBase2() + Public Async Function TestAddBase2() As Task Dim code = class $$C : B { } @@ -1706,11 +1707,11 @@ class $$C : B { } class C : A, B { } - TestAddBase(code, "A", Nothing, expected) - End Sub + Await TestAddBase(code, "A", Nothing, expected) + End Function - Public Sub AddBase3() + Public Async Function TestAddBase3() As Task Dim code = class $$C @@ -1724,15 +1725,15 @@ class C : B { } - TestAddBase(code, "B", Nothing, expected) - End Sub + Await TestAddBase(code, "B", Nothing, expected) + End Function #End Region #Region "AddEvent tests" - Public Sub AddEvent1() + Public Async Function TestAddEvent1() As Task Dim code = class C$$ @@ -1748,11 +1749,11 @@ class C } - TestAddEvent(code, expected, New EventData With {.Name = "E", .FullDelegateName = "System.EventHandler"}) - End Sub + Await TestAddEvent(code, expected, New EventData With {.Name = "E", .FullDelegateName = "System.EventHandler"}) + End Function - Public Sub AddEvent2() + Public Async Function TestAddEvent2() As Task Dim code = class C$$ @@ -1777,15 +1778,15 @@ class C } - TestAddEvent(code, expected, New EventData With {.Name = "E", .FullDelegateName = "System.EventHandler", .CreatePropertyStyleEvent = True}) - End Sub + Await TestAddEvent(code, expected, New EventData With {.Name = "E", .FullDelegateName = "System.EventHandler", .CreatePropertyStyleEvent = True}) + End Function #End Region #Region "AddFunction tests" - Public Sub AddFunction1() + Public Async Function TestAddFunction1() As Task Dim code = class $$C { } @@ -1802,11 +1803,11 @@ class C } - TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "void"}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "void"}) + End Function - Public Sub AddFunction2() + Public Async Function TestAddFunction2() As Task Dim code = class $$C @@ -1825,11 +1826,11 @@ class C } - TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "void"}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "void"}) + End Function - Public Sub AddFunction3() + Public Async Function TestAddFunction3() As Task Dim code = class $$C @@ -1848,11 +1849,11 @@ class C } - TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "System.Void"}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "System.Void"}) + End Function - Public Sub AddFunction4() + Public Async Function TestAddFunction4() As Task Dim code = class $$C @@ -1874,11 +1875,11 @@ class C } - TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "void"}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "void"}) + End Function - Public Sub AddFunction5() + Public Async Function TestAddFunction5() As Task Dim code = class $$C @@ -1900,11 +1901,11 @@ class C } - TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "void", .Position = 1}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "void", .Position = 1}) + End Function - Public Sub AddFunction6() + Public Async Function TestAddFunction6() As Task Dim code = class $$C @@ -1926,11 +1927,11 @@ class C } - TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "void", .Position = "i"}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "void", .Position = "i"}) + End Function - Public Sub AddFunction_Constructor1() + Public Async Function TestAddFunction_Constructor1() As Task Dim code = class $$C @@ -1948,11 +1949,11 @@ class C } - TestAddFunction(code, expected, New FunctionData With {.Name = "C", .Kind = EnvDTE.vsCMFunction.vsCMFunctionConstructor}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "C", .Kind = EnvDTE.vsCMFunction.vsCMFunctionConstructor}) + End Function - Public Sub AddFunction_Constructor2() + Public Async Function TestAddFunction_Constructor2() As Task Dim code = class $$C @@ -1970,11 +1971,11 @@ class C } - TestAddFunction(code, expected, New FunctionData With {.Name = "C", .Kind = EnvDTE.vsCMFunction.vsCMFunctionConstructor, .Access = EnvDTE.vsCMAccess.vsCMAccessPublic}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "C", .Kind = EnvDTE.vsCMFunction.vsCMFunctionConstructor, .Access = EnvDTE.vsCMAccess.vsCMAccessPublic}) + End Function - Public Sub AddFunction_EscapedName() + Public Async Function TestAddFunction_EscapedName() As Task Dim code = class $$C @@ -1993,11 +1994,11 @@ class C } - TestAddFunction(code, expected, New FunctionData With {.Name = "@as", .Type = "void", .Access = EnvDTE.vsCMAccess.vsCMAccessPublic}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "@as", .Type = "void", .Access = EnvDTE.vsCMAccess.vsCMAccessPublic}) + End Function - Public Sub AddFunction_Destructor() + Public Async Function TestAddFunction_Destructor() As Task Dim code = class $$C @@ -2015,12 +2016,12 @@ class C } - TestAddFunction(code, expected, New FunctionData With {.Name = "C", .Kind = EnvDTE.vsCMFunction.vsCMFunctionDestructor, .Type = "void", .Access = EnvDTE.vsCMAccess.vsCMAccessPublic}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "C", .Kind = EnvDTE.vsCMFunction.vsCMFunctionDestructor, .Type = "void", .Access = EnvDTE.vsCMAccess.vsCMAccessPublic}) + End Function - Public Sub AddFunction_AfterIncompleteMember() + Public Async Function TestAddFunction_AfterIncompleteMember() As Task Dim code = class $$C @@ -2042,25 +2043,25 @@ class C } - TestAddFunction(code, expected, New FunctionData With {.Name = "M2", .Type = "void", .Position = -1, .Access = EnvDTE.vsCMAccess.vsCMAccessPrivate}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "M2", .Type = "void", .Position = -1, .Access = EnvDTE.vsCMAccess.vsCMAccessPrivate}) + End Function #End Region #Region "AddImplementedInterface tests" - Public Sub AddImplementedInterface1() + Public Async Function TestAddImplementedInterface1() As Task Dim code = class $$C { } - TestAddImplementedInterfaceThrows(Of ArgumentException)(code, "I", Nothing) - End Sub + Await TestAddImplementedInterfaceThrows(Of ArgumentException)(code, "I", Nothing) + End Function - Public Sub AddImplementedInterface2() + Public Async Function TestAddImplementedInterface2() As Task Dim code = class $$C { } @@ -2073,11 +2074,11 @@ class C : I { } interface I { } - TestAddImplementedInterface(code, "I", -1, expected) - End Sub + Await TestAddImplementedInterface(code, "I", -1, expected) + End Function - Public Sub AddImplementedInterface3() + Public Async Function TestAddImplementedInterface3() As Task Dim code = class $$C : I { } @@ -2092,11 +2093,11 @@ interface I { } interface J { } - TestAddImplementedInterface(code, "J", -1, expected) - End Sub + Await TestAddImplementedInterface(code, "J", -1, expected) + End Function - Public Sub AddImplementedInterface4() + Public Async Function TestAddImplementedInterface4() As Task Dim code = class $$C : I { } @@ -2111,11 +2112,11 @@ interface I { } interface J { } - TestAddImplementedInterface(code, "J", 0, expected) - End Sub + Await TestAddImplementedInterface(code, "J", 0, expected) + End Function - Public Sub AddImplementedInterface5() + Public Async Function TestAddImplementedInterface5() As Task Dim code = class $$C : I, K { } @@ -2132,15 +2133,15 @@ interface J { } interface K { } - TestAddImplementedInterface(code, "J", 1, expected) - End Sub + Await TestAddImplementedInterface(code, "J", 1, expected) + End Function #End Region #Region "AddProperty tests" - Public Sub AddProperty1() + Public Async Function TestAddProperty1() As Task Dim code = class C$$ @@ -2166,11 +2167,11 @@ class C } - TestAddProperty(code, expected, New PropertyData With {.GetterName = "Name", .PutterName = "Name", .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefString}) - End Sub + Await TestAddProperty(code, expected, New PropertyData With {.GetterName = "Name", .PutterName = "Name", .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefString}) + End Function - Public Sub AddProperty2() + Public Async Function TestAddProperty2() As Task Dim code = class C$$ @@ -2192,11 +2193,11 @@ class C } - TestAddProperty(code, expected, New PropertyData With {.GetterName = "Name", .PutterName = Nothing, .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefString}) - End Sub + Await TestAddProperty(code, expected, New PropertyData With {.GetterName = "Name", .PutterName = Nothing, .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefString}) + End Function - Public Sub AddProperty3() + Public Async Function TestAddProperty3() As Task Dim code = class C$$ @@ -2217,15 +2218,15 @@ class C } - TestAddProperty(code, expected, New PropertyData With {.GetterName = Nothing, .PutterName = "Name", .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefString}) - End Sub + Await TestAddProperty(code, expected, New PropertyData With {.GetterName = Nothing, .PutterName = "Name", .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefString}) + End Function #End Region #Region "AddVariable tests" - Public Sub AddVariable1() + Public Async Function TestAddVariable1() As Task Dim code = class $$C { } @@ -2239,11 +2240,11 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) + End Function - Public Sub AddVariable2() + Public Async Function TestAddVariable2() As Task Dim code = class $$C @@ -2259,11 +2260,11 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) + End Function - Public Sub AddVariable3() + Public Async Function TestAddVariable3() As Task Dim code = class $$C @@ -2282,11 +2283,11 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "Foo"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "Foo"}) + End Function - Public Sub AddVariable4() + Public Async Function TestAddVariable4() As Task Dim code = class $$C @@ -2307,11 +2308,11 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) + End Function - Public Sub AddVariable5() + Public Async Function TestAddVariable5() As Task Dim code = class $$C @@ -2333,11 +2334,11 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) + End Function - Public Sub AddVariable6() + Public Async Function TestAddVariable6() As Task Dim code = class $$C @@ -2359,11 +2360,11 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) + End Function - Public Sub AddVariable7() + Public Async Function TestAddVariable7() As Task Dim code = class $$C @@ -2385,11 +2386,11 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "y"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "y"}) + End Function - Public Sub AddVariable8() + Public Async Function TestAddVariable8() As Task Dim code = class $$C @@ -2408,11 +2409,11 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = 0}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = 0}) + End Function - Public Sub AddVariable9() + Public Async Function TestAddVariable9() As Task Dim code = class $$C @@ -2431,11 +2432,11 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = -1}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = -1}) + End Function - Public Sub AddVariable10() + Public Async Function TestAddVariable10() As Task Dim code = class $$C @@ -2455,11 +2456,11 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) + End Function - Public Sub AddVariable11() + Public Async Function TestAddVariable11() As Task Dim code = class $$C @@ -2479,11 +2480,11 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) + End Function - Public Sub AddVariable12() + Public Async Function TestAddVariable12() As Task Dim code = class $$C @@ -2503,11 +2504,11 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "y"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "y"}) + End Function - Public Sub AddVariable13() + Public Async Function TestAddVariable13() As Task Dim code = class $$C @@ -2523,12 +2524,12 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessPublic}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessPublic}) + End Function - Public Sub AddVariable14() + Public Async Function TestAddVariable14() As Task Dim code = class $$C @@ -2544,12 +2545,12 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessPrivate}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessPrivate}) + End Function - Public Sub AddVariable15() + Public Async Function TestAddVariable15() As Task Dim code = class $$C @@ -2565,12 +2566,12 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessProject}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessProject}) + End Function - Public Sub AddVariable16() + Public Async Function TestAddVariable16() As Task Dim code = class $$C @@ -2586,12 +2587,12 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected}) + End Function - Public Sub AddVariable17() + Public Async Function TestAddVariable17() As Task Dim code = class $$C @@ -2607,11 +2608,11 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessProtected}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessProtected}) + End Function - Public Sub AddVariableOutsideOfRegion() + Public Async Function TestAddVariableOutsideOfRegion() As Task Dim code = class $$C @@ -2634,12 +2635,12 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "j", .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefInt, .Position = "i"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "j", .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefInt, .Position = "i"}) + End Function - Public Sub AddVariableAfterComment() + Public Async Function TestAddVariableAfterComment() As Task Dim code = class $$C @@ -2657,15 +2658,15 @@ class C } - TestAddVariable(code, expected, New VariableData With {.Name = "j", .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefInt, .Position = "i"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "j", .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefInt, .Position = "i"}) + End Function #End Region #Region "RemoveBase tests" - Public Sub RemoveBase1() + Public Async Function TestRemoveBase1() As Task Dim code = class $$C : B { } @@ -2675,11 +2676,11 @@ class $$C : B { } class C { } - TestRemoveBase(code, "B", expected) - End Sub + Await TestRemoveBase(code, "B", expected) + End Function - Public Sub RemoveBase2() + Public Async Function TestRemoveBase2() As Task Dim code = class $$C : A, B { } @@ -2689,15 +2690,15 @@ class $$C : A, B { } class C : B { } - TestRemoveBase(code, "A", expected) - End Sub + Await TestRemoveBase(code, "A", expected) + End Function #End Region #Region "RemoveImplementedInterface tests" - Public Sub RemoveImplementedInterface1() + Public Async Function TestRemoveImplementedInterface1() As Task Dim code = class $$C : I { } @@ -2709,11 +2710,11 @@ interface I { } class C { } interface I { } - TestRemoveImplementedInterface(code, "I", expected) - End Sub + Await TestRemoveImplementedInterface(code, "I", expected) + End Function - Public Sub RemoveImplementedInterface2() + Public Async Function TestRemoveImplementedInterface2() As Task Dim code = class $$C : A, I { } @@ -2727,15 +2728,15 @@ class C : A { } class A { } interface I { } - TestRemoveImplementedInterface(code, "I", expected) - End Sub + Await TestRemoveImplementedInterface(code, "I", expected) + End Function #End Region #Region "RemoveMember tests" - Public Sub RemoveMember1() + Public Async Function TestRemoveMember1() As Task Dim code = class $$C @@ -2753,11 +2754,11 @@ class C } - TestRemoveChild(code, expected, "Foo") - End Sub + Await TestRemoveChild(code, expected, "Foo") + End Function - Public Sub RemoveMember2() + Public Async Function TestRemoveMember2() As Task Dim code = - TestRemoveChild(code, expected, "Foo") - End Sub + Await TestRemoveChild(code, expected, "Foo") + End Function - Public Sub RemoveMember3() + Public Async Function TestRemoveMember3() As Task Dim code = - TestRemoveChild(code, expected, "Foo") - End Sub + Await TestRemoveChild(code, expected, "Foo") + End Function - Public Sub RemoveMember4() + Public Async Function TestRemoveMember4() As Task Dim code = - TestRemoveChild(code, expected, "Foo") - End Sub + Await TestRemoveChild(code, expected, "Foo") + End Function - Public Sub RemoveMember5() + Public Async Function TestRemoveMember5() As Task Dim code = - TestRemoveChild(code, expected, "Foo") - End Sub + Await TestRemoveChild(code, expected, "Foo") + End Function - Public Sub RemoveMember6() + Public Async Function TestRemoveMember6() As Task Dim code = - TestRemoveChild(code, expected, "Foo") - End Sub + Await TestRemoveChild(code, expected, "Foo") + End Function - Public Sub RemoveMember7() + Public Async Function TestRemoveMember7() As Task Dim code = - TestRemoveChild(code, expected, "b") - End Sub + Await TestRemoveChild(code, expected, "b") + End Function - Public Sub RemoveMember8() + Public Async Function TestRemoveMember8() As Task Dim code = class $$C @@ -2947,11 +2948,11 @@ class C } - TestRemoveChild(code, expected, "Foo") - End Sub + Await TestRemoveChild(code, expected, "Foo") + End Function - Public Sub RemoveMember_Event1() + Public Async Function TestRemoveMember_Event1() As Task Dim code = class $$C @@ -2967,11 +2968,11 @@ class C } - TestRemoveChild(code, expected, "E") - End Sub + Await TestRemoveChild(code, expected, "E") + End Function - Public Sub RemoveMember_Event2() + Public Async Function TestRemoveMember_Event2() As Task Dim code = class $$C @@ -2988,11 +2989,11 @@ class C } - TestRemoveChild(code, expected, "E") - End Sub + Await TestRemoveChild(code, expected, "E") + End Function - Public Sub RemoveMember_Event3() + Public Async Function TestRemoveMember_Event3() As Task Dim code = class $$C @@ -3009,11 +3010,11 @@ class C } - TestRemoveChild(code, expected, "F") - End Sub + Await TestRemoveChild(code, expected, "F") + End Function - Public Sub RemoveMember_Event4() + Public Async Function TestRemoveMember_Event4() As Task Dim code = class $$C @@ -3030,11 +3031,11 @@ class C } - TestRemoveChild(code, expected, "G") - End Sub + Await TestRemoveChild(code, expected, "G") + End Function - Public Sub RemoveMember_Event5() + Public Async Function TestRemoveMember_Event5() As Task Dim code = class $$C @@ -3054,15 +3055,15 @@ class C } - TestRemoveChild(code, expected, "E") - End Sub + Await TestRemoveChild(code, expected, "E") + End Function #End Region #Region "Set Access tests" - Public Sub SetAccess1() + Public Async Function TestSetAccess1() As Task Dim code = class $$C @@ -3077,11 +3078,11 @@ public class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetAccess2() + Public Async Function TestSetAccess2() As Task Dim code = public class $$C @@ -3096,11 +3097,11 @@ internal class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub SetAccess3() + Public Async Function TestSetAccess3() As Task Dim code = protected internal class $$C @@ -3115,11 +3116,11 @@ public class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetAccess4() + Public Async Function TestSetAccess4() As Task Dim code = public class $$C @@ -3134,11 +3135,11 @@ public class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) + End Function - Public Sub SetAccess5() + Public Async Function TestSetAccess5() As Task Dim code = public class $$C @@ -3153,11 +3154,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetAccess6() + Public Async Function TestSetAccess6() As Task Dim code = public class $$C @@ -3172,11 +3173,11 @@ public class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPrivate, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPrivate, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) + End Function - Public Sub SetAccess7() + Public Async Function TestSetAccess7() As Task Dim code = class C @@ -3197,15 +3198,15 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function #End Region #Region "Set ClassKind tests" - Public Sub SetClassKind1() + Public Async Function TestSetClassKind1() As Task Dim code = class $$C @@ -3220,11 +3221,11 @@ class C } - TestSetClassKind(code, expected, EnvDTE80.vsCMClassKind.vsCMClassKindMainClass) - End Sub + Await TestSetClassKind(code, expected, EnvDTE80.vsCMClassKind.vsCMClassKindMainClass) + End Function - Public Sub SetClassKind2() + Public Async Function TestSetClassKind2() As Task Dim code = class $$C @@ -3239,11 +3240,11 @@ partial class C } - TestSetClassKind(code, expected, EnvDTE80.vsCMClassKind.vsCMClassKindPartialClass) - End Sub + Await TestSetClassKind(code, expected, EnvDTE80.vsCMClassKind.vsCMClassKindPartialClass) + End Function - Public Sub SetClassKind3() + Public Async Function TestSetClassKind3() As Task Dim code = partial class $$C @@ -3258,15 +3259,15 @@ class C } - TestSetClassKind(code, expected, EnvDTE80.vsCMClassKind.vsCMClassKindMainClass) - End Sub + Await TestSetClassKind(code, expected, EnvDTE80.vsCMClassKind.vsCMClassKindMainClass) + End Function #End Region #Region "Set Comment tests" - Public Sub SetComment1() + Public Async Function TestSetComment1() As Task Dim code = // Foo @@ -3280,11 +3281,11 @@ class $$C { } class C { } - TestSetComment(code, expected, Nothing) - End Sub + Await TestSetComment(code, expected, Nothing) + End Function - Public Sub SetComment2() + Public Async Function TestSetComment2() As Task Dim code = // Foo @@ -3300,11 +3301,11 @@ class $$C { } class C { } - TestSetComment(code, expected, "Bar") - End Sub + Await TestSetComment(code, expected, "Bar") + End Function - Public Sub SetComment3() + Public Async Function TestSetComment3() As Task Dim code = // Foo @@ -3319,15 +3320,15 @@ class $$C { } class C { } - TestSetComment(code, expected, "Blah") - End Sub + Await TestSetComment(code, expected, "Blah") + End Function #End Region #Region "Set DocComment tests" - Public Sub SetDocComment_Nothing() + Public Async Function TestSetDocComment_Nothing() As Task Dim code = class $$C { } @@ -3338,11 +3339,11 @@ class $$C { } class C { } - TestSetDocComment(code, expected, Nothing, ThrowsArgumentException(Of String)) - End Sub + Await TestSetDocComment(code, expected, Nothing, ThrowsArgumentException(Of String)) + End Function - Public Sub SetDocComment_InvalidXml1() + Public Async Function TestSetDocComment_InvalidXml1() As Task Dim code = class $$C { } @@ -3353,11 +3354,11 @@ class $$C { } class C { } - TestSetDocComment(code, expected, "Blah", ThrowsArgumentException(Of String)) - End Sub + Await TestSetDocComment(code, expected, "Blah", ThrowsArgumentException(Of String)) + End Function - Public Sub SetDocComment_InvalidXml2() + Public Async Function TestSetDocComment_InvalidXml2() As Task Dim code = class $$C { } @@ -3368,11 +3369,11 @@ class $$C { } class C { } - TestSetDocComment(code, expected, "Blah", ThrowsArgumentException(Of String)) - End Sub + Await TestSetDocComment(code, expected, "Blah", ThrowsArgumentException(Of String)) + End Function - Public Sub SetDocComment1() + Public Async Function TestSetDocComment1() As Task Dim code = class $$C { } @@ -3384,11 +3385,11 @@ class $$C { } class C { } - TestSetDocComment(code, expected, "Hello World") - End Sub + Await TestSetDocComment(code, expected, "Hello World") + End Function - Public Sub SetDocComment2() + Public Async Function TestSetDocComment2() As Task Dim code = /// <summary>Hello World</summary> @@ -3401,11 +3402,11 @@ class $$C { } class C { } - TestSetDocComment(code, expected, "Blah") - End Sub + Await TestSetDocComment(code, expected, "Blah") + End Function - Public Sub SetDocComment3() + Public Async Function TestSetDocComment3() As Task Dim code = // Foo @@ -3419,11 +3420,11 @@ class $$C { } class C { } - TestSetDocComment(code, expected, "Blah") - End Sub + Await TestSetDocComment(code, expected, "Blah") + End Function - Public Sub SetDocComment4() + Public Async Function TestSetDocComment4() As Task Dim code = /// <summary>FogBar</summary> @@ -3438,11 +3439,11 @@ class $$C { } class C { } - TestSetDocComment(code, expected, "Blah") - End Sub + Await TestSetDocComment(code, expected, "Blah") + End Function - Public Sub SetDocComment5() + Public Async Function TestSetDocComment5() As Task Dim code = namespace N @@ -3460,15 +3461,15 @@ namespace N } - TestSetDocComment(code, expected, "Hello World") - End Sub + Await TestSetDocComment(code, expected, "Hello World") + End Function #End Region #Region "Set InheritanceKind tests" - Public Sub SetInheritanceKind1() + Public Async Function TestSetInheritanceKind1() As Task Dim code = class $$C @@ -3483,11 +3484,11 @@ abstract class C } - TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract) - End Sub + Await TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract) + End Function - Public Sub SetInheritanceKind2() + Public Async Function TestSetInheritanceKind2() As Task Dim code = class $$C @@ -3502,11 +3503,11 @@ sealed class C } - TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindSealed) - End Sub + Await TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindSealed) + End Function - Public Sub SetInheritanceKind3() + Public Async Function TestSetInheritanceKind3() As Task Dim code = class C @@ -3527,11 +3528,11 @@ class C } - TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract) - End Sub + Await TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract) + End Function - Public Sub SetInheritanceKind4() + Public Async Function TestSetInheritanceKind4() As Task Dim code = class C @@ -3552,15 +3553,15 @@ class C } - TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindSealed Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) - End Sub + Await TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindSealed Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) + End Function #End Region #Region "Set IsAbstract tests" - Public Sub SetIsAbstract1() + Public Async Function TestSetIsAbstract1() As Task Dim code = class $$C @@ -3575,11 +3576,11 @@ abstract class C } - TestSetIsAbstract(code, expected, True) - End Sub + Await TestSetIsAbstract(code, expected, True) + End Function - Public Sub SetIsAbstract2() + Public Async Function TestSetIsAbstract2() As Task Dim code = abstract class $$C @@ -3594,11 +3595,11 @@ class C } - TestSetIsAbstract(code, expected, False) - End Sub + Await TestSetIsAbstract(code, expected, False) + End Function - Public Sub SetIsAbstract3() + Public Async Function TestSetIsAbstract3() As Task Dim code = class C @@ -3619,11 +3620,11 @@ class C } - TestSetIsAbstract(code, expected, True) - End Sub + Await TestSetIsAbstract(code, expected, True) + End Function - Public Sub SetIsAbstract4() + Public Async Function TestSetIsAbstract4() As Task Dim code = class C @@ -3644,11 +3645,11 @@ class C } - TestSetIsAbstract(code, expected, False) - End Sub + Await TestSetIsAbstract(code, expected, False) + End Function - Public Sub SetIsAbstract5() + Public Async Function TestSetIsAbstract5() As Task ' Note: In Dev11 the C# Code Model will happily include an abstract modifier ' on a sealed class. This differs from VB Code Model where the NotInheritable ' modifier will be removed when adding MustInherit. In Roslyn, we take the Dev11 @@ -3668,15 +3669,15 @@ abstract class C } - TestSetIsAbstract(code, expected, True) - End Sub + Await TestSetIsAbstract(code, expected, True) + End Function #End Region #Region "Set IsShared tests" - Public Sub SetIsShared1() + Public Async Function TestSetIsShared1() As Task Dim code = class $$C @@ -3691,11 +3692,11 @@ static class C } - TestSetIsShared(code, expected, True) - End Sub + Await TestSetIsShared(code, expected, True) + End Function - Public Sub SetIsShared2() + Public Async Function TestSetIsShared2() As Task Dim code = static class $$C @@ -3710,14 +3711,14 @@ class C } - TestSetIsShared(code, expected, False) - End Sub + Await TestSetIsShared(code, expected, False) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = class $$Foo @@ -3732,11 +3733,11 @@ class Bar } - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function - Public Sub SetName2() + Public Async Function TestSetName2() As Task Dim code = class $$Foo @@ -3757,11 +3758,11 @@ class Bar } - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function - Public Sub SetName3() + Public Async Function TestSetName3() As Task Dim code = partial class $$Foo @@ -3784,13 +3785,13 @@ partial class Foo } - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region - Public Sub GetBaseName1() + Public Async Function TestGetBaseName1() As Task Dim code = using N.M; @@ -3808,11 +3809,11 @@ class $$C : Generic<string> } - TestGetBaseName(code, "N.M.Generic") - End Sub + Await TestGetBaseName(code, "N.M.Generic") + End Function - Public Sub TypeDescriptor_GetProperties() + Public Async Function TestTypeDescriptor_GetProperties() As Task Dim code = class $$C @@ -3828,11 +3829,11 @@ class $$C "ClassKind", "PartialClasses", "DataTypeKind", "Parts", "InheritanceKind", "IsGeneric", "IsShared"} - TestPropertyDescriptors(code, expectedPropertyNames) - End Sub + Await TestPropertyDescriptors(code, expectedPropertyNames) + End Function - Public Sub ExternalClass_ImplementedInterfaces() + Public Async Function TestExternalClass_ImplementedInterfaces() As Task Dim code = class $$Foo : System.Collections.Generic.List<int> @@ -3840,24 +3841,24 @@ class $$Foo : System.Collections.Generic.List<int> } - TestElement(code, + Await TestElement(code, Sub(codeClass) Dim listType = TryCast(codeClass.Bases.Item(1), EnvDTE80.CodeClass2) Assert.NotNull(listType) Assert.Equal(8, listType.ImplementedInterfaces.Count) End Sub) - End Sub + End Function - Public Sub ExternalFunction_Overloads() + Public Async Function TestExternalFunction_Overloads() As Task Dim code = class $$Derived : System.Console { } - TestElement( + Await TestElement( code, Sub(codeClass) Dim baseType = TryCast(codeClass.Bases.Item(1), EnvDTE80.CodeClass2) @@ -3870,17 +3871,17 @@ class $$Derived : System.Console Assert.Equal(19, method1.Overloads.Count) End Sub) - End Sub + End Function - Public Sub ExternalFunction_Overloads_NotOverloaded() + Public Async Function TestExternalFunction_Overloads_NotOverloaded() As Task Dim code = class $$Derived : System.Console { } - TestElement( + Await TestElement( code, Sub(codeClass) Dim baseType = TryCast(codeClass.Bases.Item(1), EnvDTE80.CodeClass2) @@ -3893,13 +3894,12 @@ class $$Derived : System.Console Assert.Equal("System.Console.Clear", TryCast(method2.Overloads.Item(1), EnvDTE80.CodeFunction2).FullName) End Sub) - End Sub + End Function Protected Overrides ReadOnly Property LanguageName As String Get Return LanguageNames.CSharp End Get End Property - End Class -End Namespace +End Namespace \ No newline at end of file diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeDelegateTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeDelegateTests.vb index 9c9b194d4577ca5adf8b0ae9751dcfa6856e4c26..5090d09ab402d1a55979c4a164f370db917cb26d 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeDelegateTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeDelegateTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,13 +11,13 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "GetStartPoint() tests" - Public Sub GetStartPoint1() + Public Async Function TestGetStartPoint1() As Task Dim code = delegate void $$Foo(int i); - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -37,17 +38,17 @@ delegate void $$Foo(int i); ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=25))) - End Sub + End Function - Public Sub GetStartPoint2() + Public Async Function TestGetStartPoint2() As Task Dim code = [System.CLSCompliant(true)] delegate void $$Foo(int i); - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -68,20 +69,20 @@ delegate void $$Foo(int i); ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=27))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint1() + Public Async Function TestGetEndPoint1() As Task Dim code = delegate void $$Foo(int i); - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -102,17 +103,17 @@ delegate void $$Foo(int i); ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=26, absoluteOffset:=26, lineLength:=25))) - End Sub + End Function - Public Sub GetEndPoint2() + Public Async Function TestGetEndPoint2() As Task Dim code = [System.CLSCompliant(true)] delegate void $$Foo(int i); - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -133,28 +134,28 @@ delegate void $$Foo(int i); ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=26, absoluteOffset:=54, lineLength:=25))) - End Sub + End Function #End Region #Region "BaseClass tests" - Public Sub BaseClass() + Public Async Function TestBaseClass1() As Task Dim code = delegate void $$D(); - TestBaseClass(code, "System.Delegate") - End Sub + Await TestBaseClass(code, "System.Delegate") + End Function #End Region #Region "Prototype tests" - Public Sub Prototype_UniqueSignature() + Public Async Function TestPrototype_UniqueSignature() As Task Dim code = namespace N @@ -163,11 +164,11 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature, "N.D") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature, "N.D") + End Function - Public Sub Prototype_ClassName() + Public Async Function TestPrototype_ClassName() As Task Dim code = namespace N @@ -176,11 +177,11 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "delegate N.D") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "delegate N.D") + End Function - Public Sub Prototype_FullName() + Public Async Function TestPrototype_FullName() As Task Dim code = namespace N @@ -189,11 +190,11 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "delegate N.D") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "delegate N.D") + End Function - Public Sub Prototype_Type() + Public Async Function TestPrototype_Type() As Task Dim code = namespace N @@ -202,50 +203,50 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "delegate void D") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "delegate void D") + End Function #End Region #Region "Type tests" - Public Sub Type_Void() + Public Async Function TestType_Void() As Task Dim code = delegate void $$D(); - TestTypeProp(code, New CodeTypeRefData With {.CodeTypeFullName = "System.Void", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefVoid}) - End Sub + Await TestTypeProp(code, New CodeTypeRefData With {.CodeTypeFullName = "System.Void", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefVoid}) + End Function - Public Sub Type_Int() + Public Async Function TestType_Int() As Task Dim code = delegate int $$D(); - TestTypeProp(code, New CodeTypeRefData With {.CodeTypeFullName = "System.Int32", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefInt}) - End Sub + Await TestTypeProp(code, New CodeTypeRefData With {.CodeTypeFullName = "System.Int32", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefInt}) + End Function - Public Sub Type_SourceClass() + Public Async Function TestType_SourceClass() As Task Dim code = class C { } delegate C $$D(); - TestTypeProp(code, New CodeTypeRefData With {.CodeTypeFullName = "C", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType}) - End Sub + Await TestTypeProp(code, New CodeTypeRefData With {.CodeTypeFullName = "C", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType}) + End Function #End Region #Region "Set Type tests" - Public Sub SetType1() + Public Async Function TestSetType1() As Task Dim code = public delegate int $$D(); @@ -256,11 +257,11 @@ public delegate int $$D(); public delegate void D(); - TestSetTypeProp(code, expected, "void") - End Sub + Await TestSetTypeProp(code, expected, "void") + End Function - Public Sub SetType2() + Public Async Function TestSetType2() As Task Dim code = public delegate string $$D(); @@ -271,8 +272,8 @@ public delegate string $$D(); public delegate int? D(); - TestSetTypeProp(code, expected, "System.Nullable") - End Sub + Await TestSetTypeProp(code, expected, "System.Nullable") + End Function #End Region @@ -280,31 +281,31 @@ public delegate int? D(); - Public Sub TestParameterNameWithEscapeCharacters() + Public Async Function TestParameterNameWithEscapeCharacters() As Task Dim code = public delegate int $$M(int @int); - TestAllParameterNames(code, "@int") - End Sub + Await TestAllParameterNames(code, "@int") + End Function - Public Sub TestParameterNameWithEscapeCharacters_2() + Public Async Function TestParameterNameWithEscapeCharacters_2() As Task Dim code = public delegate int $$M(int @int, string @string); - TestAllParameterNames(code, "@int", "@string") - End Sub + Await TestAllParameterNames(code, "@int", "@string") + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = using System; @@ -319,11 +320,11 @@ using System; [Serializable()] delegate void D(); - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = using System; @@ -340,12 +341,12 @@ using System; [CLSCompliant(true)] delegate void D(); - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment() + Public Async Function TestAddAttribute_BelowDocComment() As Task Dim code = using System; @@ -362,13 +363,13 @@ using System; [CLSCompliant(true)] delegate void D(); - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) + End Function #End Region - Public Sub TypeDescriptor_GetProperties() + Public Async Function TestTypeDescriptor_GetProperties() As Task Dim code = delegate void $$D(); @@ -381,8 +382,8 @@ delegate void $$D(); "Bases", "Members", "Access", "Attributes", "DocComment", "Comment", "DerivedTypes", "BaseClass", "Type", "Parameters", "IsGeneric"} - TestPropertyDescriptors(code, expectedPropertyNames) - End Sub + Await TestPropertyDescriptors(code, expectedPropertyNames) + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeEnumTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeEnumTests.vb index a91c34f01c157695c70901a3a6ffa6718a4ff032..1c2e49d612559da7b6b36f847cd6a94c17054ea1 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeEnumTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeEnumTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,17 +11,17 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "Access tests" - Public Sub Access1() + Public Async Function TestAccess1() As Task Dim code = enum $$E { } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access2() + Public Async Function TestAccess2() As Task Dim code = class C @@ -29,65 +30,65 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access3() + Public Async Function TestAccess3() As Task Dim code = private enum $$E { } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access4() + Public Async Function TestAccess4() As Task Dim code = protected enum $$E { } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) + End Function - Public Sub Access5() + Public Async Function TestAccess5() As Task Dim code = protected internal enum $$E { } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub Access6() + Public Async Function TestAccess6() As Task Dim code = internal enum $$E { } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access7() + Public Async Function TestAccess7() As Task Dim code = public enum $$E { } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function #End Region #Region "Bases tests" - Public Sub Bases1() + Public Async Function TestBases1() As Task Dim code = enum $$E @@ -96,15 +97,15 @@ enum $$E Bar } - TestBases(code, IsElement("Enum")) - End Sub + Await TestBases(code, IsElement("Enum")) + End Function #End Region #Region "Attributes tests" - Public Sub Attributes1() + Public Async Function TestAttributes1() As Task Dim code = enum $$C @@ -113,11 +114,11 @@ enum $$C } - TestAttributes(code, NoElements) - End Sub + Await TestAttributes(code, NoElements) + End Function - Public Sub Attributes2() + Public Async Function TestAttributes2() As Task Dim code = using System; @@ -129,11 +130,11 @@ enum $$C } - TestAttributes(code, IsElement("Flags")) - End Sub + Await TestAttributes(code, IsElement("Flags")) + End Function - Public Sub Attributes3() + Public Async Function TestAttributes3() As Task Dim code = using System; @@ -145,11 +146,11 @@ enum $$C } - TestAttributes(code, IsElement("Serializable"), IsElement("Flags")) - End Sub + Await TestAttributes(code, IsElement("Serializable"), IsElement("Flags")) + End Function - Public Sub Attributes4() + Public Async Function TestAttributes4() As Task Dim code = using System; @@ -160,14 +161,14 @@ enum $$C } - TestAttributes(code, IsElement("Serializable"), IsElement("Flags")) - End Sub + Await TestAttributes(code, IsElement("Serializable"), IsElement("Flags")) + End Function #End Region #Region "FullName tests" - Public Sub FullName1() + Public Async Function TestFullName1() As Task Dim code = enum $$E @@ -176,15 +177,15 @@ enum $$E Bar } - TestFullName(code, "E") - End Sub + Await TestFullName(code, "E") + End Function #End Region #Region "Name tests" - Public Sub Name1() + Public Async Function TestName1() As Task Dim code = enum $$E @@ -194,14 +195,14 @@ enum $$E } - TestName(code, "E") - End Sub + Await TestName(code, "E") + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = using System; @@ -224,11 +225,11 @@ enum E Bar } - TestAddAttribute(code, expected, New AttributeData With {.Name = "Flags"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Flags"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = using System; @@ -253,12 +254,12 @@ enum E Bar } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment() + Public Async Function TestAddAttribute_BelowDocComment() As Task Dim code = using System; @@ -283,15 +284,15 @@ enum E Bar } - TestAddAttribute(code, expected, New AttributeData With {.Name = "Flags"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Flags"}) + End Function #End Region #Region "AddMember tests" - Public Sub AddMember1() + Public Async Function TestAddMember1() As Task Dim code = enum $$E @@ -307,11 +308,11 @@ enum E } - TestAddEnumMember(code, expected, New EnumMemberData With {.Name = "V"}) - End Sub + Await TestAddEnumMember(code, expected, New EnumMemberData With {.Name = "V"}) + End Function - Public Sub AddMember2() + Public Async Function TestAddMember2() As Task Dim code = enum $$E @@ -327,11 +328,11 @@ enum E } - TestAddEnumMember(code, expected, New EnumMemberData With {.Name = "V", .Value = "1"}) - End Sub + Await TestAddEnumMember(code, expected, New EnumMemberData With {.Name = "V", .Value = "1"}) + End Function - Public Sub AddMember3() + Public Async Function TestAddMember3() As Task Dim code = enum $$E @@ -349,12 +350,12 @@ enum E } - TestAddEnumMember(code, expected, New EnumMemberData With {.Name = "U", .Value = "V"}) - End Sub + Await TestAddEnumMember(code, expected, New EnumMemberData With {.Name = "U", .Value = "V"}) + End Function - Public Sub AddMember4() + Public Async Function TestAddMember4() As Task Dim code = enum $$E @@ -372,12 +373,12 @@ enum E } - TestAddEnumMember(code, expected, New EnumMemberData With {.Position = -1, .Name = "B"}) - End Sub + Await TestAddEnumMember(code, expected, New EnumMemberData With {.Position = -1, .Name = "B"}) + End Function - Public Sub AddMember5() + Public Async Function TestAddMember5() As Task Dim code = enum $$E @@ -397,12 +398,12 @@ enum E } - TestAddEnumMember(code, expected, New EnumMemberData With {.Position = 1, .Name = "B"}) - End Sub + Await TestAddEnumMember(code, expected, New EnumMemberData With {.Position = 1, .Name = "B"}) + End Function - Public Sub AddMember6() + Public Async Function TestAddMember6() As Task Dim code = enum $$E @@ -422,12 +423,12 @@ enum E } - TestAddEnumMember(code, expected, New EnumMemberData With {.Position = -1, .Name = "C"}) - End Sub + Await TestAddEnumMember(code, expected, New EnumMemberData With {.Position = -1, .Name = "C"}) + End Function - Public Sub AddMember7() + Public Async Function TestAddMember7() As Task Dim code = enum $$E @@ -449,15 +450,15 @@ enum E } - TestAddEnumMember(code, expected, New EnumMemberData With {.Position = -1, .Name = "D"}) - End Sub + Await TestAddEnumMember(code, expected, New EnumMemberData With {.Position = -1, .Name = "D"}) + End Function #End Region #Region "RemoveMember tests" - Public Sub RemoveMember1() + Public Async Function TestRemoveMember1() As Task Dim code = enum $$E @@ -473,11 +474,11 @@ enum E } - TestRemoveChild(code, expected, "A") - End Sub + Await TestRemoveChild(code, expected, "A") + End Function - Public Sub RemoveMember2() + Public Async Function TestRemoveMember2() As Task Dim code = enum $$E @@ -495,11 +496,11 @@ enum E } - TestRemoveChild(code, expected, "A") - End Sub + Await TestRemoveChild(code, expected, "A") + End Function - Public Sub RemoveMember3() + Public Async Function TestRemoveMember3() As Task Dim code = enum $$E @@ -517,11 +518,11 @@ enum E } - TestRemoveChild(code, expected, "B") - End Sub + Await TestRemoveChild(code, expected, "B") + End Function - Public Sub RemoveMember4() + Public Async Function TestRemoveMember4() As Task Dim code = enum $$E @@ -541,14 +542,14 @@ enum E } - TestRemoveChild(code, expected, "B") - End Sub + Await TestRemoveChild(code, expected, "B") + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = enum $$Foo @@ -563,12 +564,12 @@ enum Bar } - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region - Public Sub TypeDescriptor_GetProperties() + Public Async Function TestTypeDescriptor_GetProperties() As Task Dim code = enum $$E @@ -582,8 +583,8 @@ enum $$E "ExtenderCATID", "Parent", "Namespace", "Bases", "Members", "Access", "Attributes", "DocComment", "Comment", "DerivedTypes"} - TestPropertyDescriptors(code, expectedPropertyNames) - End Sub + Await TestPropertyDescriptors(code, expectedPropertyNames) + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeEventTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeEventTests.vb index a96aeb52ded8426ede9185097bde7d449aab7a89..a869b63704ddd745e407699f99848b66541652fd 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeEventTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeEventTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,7 +11,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "GetStartPoint tests" - Public Sub GetStartPoint1() + Public Async Function TestGetStartPoint1() As Task Dim code = class C @@ -19,7 +20,7 @@ class C } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -40,10 +41,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=5, absoluteOffset:=15, lineLength:=42))) - End Sub + End Function - Public Sub GetStartPoint2() + Public Async Function TestGetStartPoint2() As Task Dim code = class C @@ -52,7 +53,7 @@ class C } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -73,10 +74,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=5, absoluteOffset:=15, lineLength:=42))) - End Sub + End Function - Public Sub GetStartPoint3() + Public Async Function TestGetStartPoint3() As Task Dim code = class C @@ -89,7 +90,7 @@ class C } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -110,11 +111,11 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=5, absoluteOffset:=15, lineLength:=38))) - End Sub + End Function - Public Sub GetStartPointExplicitlyImplementedEvent() + Public Async Function TestGetStartPointExplicitlyImplementedEvent() As Task Dim code = delegate void SampleEventHandler(object sender); @@ -139,17 +140,17 @@ class C1 : I1 } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=10, lineOffset:=5, absoluteOffset:=131, lineLength:=43))) - End Sub + End Function #End Region #Region "GetEndPoint tests" - Public Sub GetEndPoint1() + Public Async Function TestGetEndPoint1() As Task Dim code = class C @@ -158,7 +159,7 @@ class C } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -179,10 +180,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=43, absoluteOffset:=53, lineLength:=42))) - End Sub + End Function - Public Sub GetEndPoint2() + Public Async Function TestGetEndPoint2() As Task Dim code = class C @@ -191,7 +192,7 @@ class C } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -212,10 +213,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=43, absoluteOffset:=53, lineLength:=42))) - End Sub + End Function - Public Sub GetEndPoint3() + Public Async Function TestGetEndPoint3() As Task Dim code = class C @@ -228,7 +229,7 @@ class C } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -249,11 +250,11 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=7, lineOffset:=6, absoluteOffset:=96, lineLength:=5))) - End Sub + End Function - Public Sub GetEndPointExplicitlyImplementedEvent() + Public Async Function TestGetEndPointExplicitlyImplementedEvent() As Task Dim code = delegate void SampleEventHandler(object sender); @@ -278,17 +279,17 @@ class C1 : I1 } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=19, lineOffset:=6, absoluteOffset:=250, lineLength:=5))) - End Sub + End Function #End Region #Region "Access tests" - Public Sub Access1() + Public Async Function TestAccess1() As Task Dim code = class C @@ -297,11 +298,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access2() + Public Async Function TestAccess2() As Task Dim code = class C @@ -310,11 +311,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access3() + Public Async Function TestAccess3() As Task Dim code = class C @@ -323,11 +324,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) + End Function - Public Sub Access4() + Public Async Function TestAccess4() As Task Dim code = class C @@ -336,11 +337,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub Access5() + Public Async Function TestAccess5() As Task Dim code = class C @@ -349,11 +350,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access6() + Public Async Function TestAccess6() As Task Dim code = class C @@ -362,15 +363,15 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function #End Region #Region "FullName tests" - Public Sub FullName1() + Public Async Function TestFullName1() As Task Dim code = class C @@ -379,11 +380,11 @@ class C } - TestFullName(code, "C.E") - End Sub + Await TestFullName(code, "C.E") + End Function - Public Sub FullName2() + Public Async Function TestFullName2() As Task Dim code = class C @@ -392,12 +393,12 @@ class C } - TestFullName(code, "C.F") - End Sub + Await TestFullName(code, "C.F") + End Function - Public Sub FullName_ExplicitlyImplementedEvent() + Public Async Function TestFullName_ExplicitlyImplementedEvent() As Task Dim code = delegate void SampleEventHandler(object sender); @@ -422,15 +423,15 @@ class C1 : I1 } - TestFullName(code, "C1.I1.SampleEvent") - End Sub + Await TestFullName(code, "C1.I1.SampleEvent") + End Function #End Region #Region "IsPropertyStyleEvent tests" - Public Sub IsPropertyStyleEvent1() + Public Async Function TestIsPropertyStyleEvent1() As Task Dim code = class C @@ -439,11 +440,11 @@ class C } - TestIsPropertyStyleEvent(code, False) - End Sub + Await TestIsPropertyStyleEvent(code, False) + End Function - Public Sub IsPropertyStyleEvent2() + Public Async Function TestIsPropertyStyleEvent2() As Task Dim code = class C @@ -456,15 +457,15 @@ class C } - TestIsPropertyStyleEvent(code, True) - End Sub + Await TestIsPropertyStyleEvent(code, True) + End Function #End Region #Region "IsShared tests" - Public Sub IsShared1() + Public Async Function TestIsShared1() As Task Dim code = class C @@ -473,11 +474,11 @@ class C } - TestIsShared(code, False) - End Sub + Await TestIsShared(code, False) + End Function - Public Sub IsShared2() + Public Async Function TestIsShared2() As Task Dim code = class C @@ -486,15 +487,15 @@ class C } - TestIsShared(code, True) - End Sub + Await TestIsShared(code, True) + End Function #End Region #Region "Name tests" - Public Sub Name1() + Public Async Function TestName1() As Task Dim code = class C @@ -503,11 +504,11 @@ class C } - TestName(code, "E") - End Sub + Await TestName(code, "E") + End Function - Public Sub Name2() + Public Async Function TestName2() As Task Dim code = class C @@ -516,12 +517,12 @@ class C } - TestName(code, "F") - End Sub + Await TestName(code, "F") + End Function - Public Sub Name_ExplicitlyImplementedEvent() + Public Async Function TestName_ExplicitlyImplementedEvent() As Task Dim code = delegate void SampleEventHandler(object sender); @@ -546,15 +547,15 @@ class C1 : I1 } - TestName(code, "I1.SampleEvent") - End Sub + Await TestName(code, "I1.SampleEvent") + End Function #End Region #Region "Type tests" - Public Sub Type1() + Public Async Function TestType1() As Task Dim code = class C @@ -563,17 +564,17 @@ class C } - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "System.EventHandler", .AsFullName = "System.EventHandler", .CodeTypeFullName = "System.EventHandler", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType }) - End Sub + End Function - Public Sub Type2() + Public Async Function TestType2() As Task Dim code = class C @@ -582,17 +583,17 @@ class C } - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "System.EventHandler", .AsFullName = "System.EventHandler", .CodeTypeFullName = "System.EventHandler", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType }) - End Sub + End Function - Public Sub Type3() + Public Async Function TestType3() As Task Dim code = class C @@ -605,21 +606,21 @@ class C } - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "System.EventHandler", .AsFullName = "System.EventHandler", .CodeTypeFullName = "System.EventHandler", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType }) - End Sub + End Function #End Region #Region "Set IsShared tests" - Public Sub SetIsShared1() + Public Async Function TestSetIsShared1() As Task Dim code = class C @@ -636,11 +637,11 @@ class C } - TestSetIsShared(code, expected, False) - End Sub + Await TestSetIsShared(code, expected, False) + End Function - Public Sub SetIsShared2() + Public Async Function TestSetIsShared2() As Task Dim code = class C @@ -657,11 +658,11 @@ class C } - TestSetIsShared(code, expected, True) - End Sub + Await TestSetIsShared(code, expected, True) + End Function - Public Sub SetIsShared3() + Public Async Function TestSetIsShared3() As Task Dim code = class C @@ -678,11 +679,11 @@ class C } - TestSetIsShared(code, expected, True) - End Sub + Await TestSetIsShared(code, expected, True) + End Function - Public Sub SetIsShared4() + Public Async Function TestSetIsShared4() As Task Dim code = class C @@ -699,15 +700,15 @@ class C } - TestSetIsShared(code, expected, False) - End Sub + Await TestSetIsShared(code, expected, False) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = class C @@ -724,15 +725,15 @@ class C } - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region #Region "Set Type tests" - Public Sub SetType1() + Public Async Function TestSetType1() As Task Dim code = class C @@ -749,11 +750,11 @@ class C } - TestSetTypeProp(code, expected, "System.ConsoleCancelEventHandler") - End Sub + Await TestSetTypeProp(code, expected, "System.ConsoleCancelEventHandler") + End Function - Public Sub SetType2() + Public Async Function TestSetType2() As Task Dim code = class C @@ -770,11 +771,11 @@ class C } - TestSetTypeProp(code, expected, "System.ConsoleCancelEventHandler") - End Sub + Await TestSetTypeProp(code, expected, "System.ConsoleCancelEventHandler") + End Function - Public Sub SetType3() + Public Async Function TestSetType3() As Task Dim code = class C @@ -799,14 +800,14 @@ class C } - TestSetTypeProp(code, expected, "System.ConsoleCancelEventHandler") - End Sub + Await TestSetTypeProp(code, expected, "System.ConsoleCancelEventHandler") + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = using System; @@ -827,11 +828,11 @@ class C public event EventHandler E; } - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = using System; @@ -854,12 +855,12 @@ class C public event EventHandler E; } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment() + Public Async Function TestAddAttribute_BelowDocComment() As Task Dim code = using System; @@ -882,13 +883,13 @@ class C public event EventHandler E; } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) + End Function #End Region - Public Sub TypeDescriptor_GetProperties() + Public Async Function TestTypeDescriptor_GetProperties() As Task Dim code = class C @@ -903,8 +904,8 @@ class C "ExtenderCATID", "Parent", "Access", "Attributes", "DocComment", "Comment", "Adder", "Remover", "Thrower", "IsPropertyStyleEvent", "Type", "OverrideKind", "IsShared"} - TestPropertyDescriptors(code, expectedPropertyNames) - End Sub + Await TestPropertyDescriptors(code, expectedPropertyNames) + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeFunctionTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeFunctionTests.vb index 41a8a80d8b5ab4e81d48ecc2ffbfa0cafd01164f..0009b6281eeda392e01af5fcb0de5b04bcddff8c 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeFunctionTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeFunctionTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.VisualStudio.LanguageServices.CSharp.CodeModel.Extenders Imports Microsoft.VisualStudio.LanguageServices.CSharp.CodeModel.Interop @@ -12,7 +13,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "Get Start Point" - Public Sub GetStartPointConversionOperatorFunction() + Public Async Function TestGetStartPointConversionOperatorFunction() As Task Dim code = class D @@ -24,14 +25,14 @@ class D } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartBody, TextPoint(line:=5, lineOffset:=1, absoluteOffset:=65, lineLength:=23))) - End Sub + End Function - Public Sub GetStartPointExplicitlyImplementedMethod() + Public Async Function TestGetStartPointExplicitlyImplementedMethod() As Task Dim code = public interface I1 @@ -48,16 +49,16 @@ public class C1 : I1 } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=8, lineOffset:=5, absoluteOffset:=67, lineLength:=15))) - End Sub + End Function #End Region #Region "Get End Point" - Public Sub GetEndPointConversionOperatorFunction() + Public Async Function TestGetEndPointConversionOperatorFunction() As Task Dim code = class D @@ -69,14 +70,14 @@ class D } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartBody, TextPoint(line:=6, lineOffset:=1, absoluteOffset:=89, lineLength:=5))) - End Sub + End Function - Public Sub GetEndPointExplicitlyImplementedMethod() + Public Async Function TestGetEndPointExplicitlyImplementedMethod() As Task Dim code = public interface I1 @@ -93,16 +94,16 @@ public class C1 : I1 } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=11, lineOffset:=6, absoluteOffset:=108, lineLength:=5))) - End Sub + End Function #End Region #Region "Access tests" - Public Sub Access1() + Public Async Function TestAccess1() As Task Dim code = class C @@ -111,11 +112,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access2() + Public Async Function TestAccess2() As Task Dim code = class C @@ -124,11 +125,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access3() + Public Async Function TestAccess3() As Task Dim code = class C @@ -137,11 +138,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) + End Function - Public Sub Access4() + Public Async Function TestAccess4() As Task Dim code = class C @@ -150,11 +151,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub Access5() + Public Async Function TestAccess5() As Task Dim code = class C @@ -163,11 +164,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access6() + Public Async Function TestAccess6() As Task Dim code = class C @@ -176,11 +177,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access7() + Public Async Function TestAccess7() As Task Dim code = interface I @@ -189,15 +190,15 @@ interface I } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function #End Region #Region "Attribute Tests" - Public Sub PropertyGetAttribute_WithNoSet() + Public Async Function TestPropertyGetAttribute_WithNoSet() As Task Dim code = public class Class1 @@ -213,12 +214,12 @@ public class Class1 } - TestAttributes(code, IsElement("Obsolete")) - End Sub + Await TestAttributes(code, IsElement("Obsolete")) + End Function - Public Sub PropertySetAttribute_WithNoGet() + Public Async Function TestPropertySetAttribute_WithNoGet() As Task Dim code = public class Class1 @@ -233,12 +234,12 @@ public class Class1 } - TestAttributes(code, IsElement("Obsolete")) - End Sub + Await TestAttributes(code, IsElement("Obsolete")) + End Function - Public Sub PropertyGetAttribute_WithSet() + Public Async Function TestPropertyGetAttribute_WithSet() As Task Dim code = public class Class1 @@ -259,12 +260,12 @@ public class Class1 } - TestAttributes(code, IsElement("Obsolete")) - End Sub + Await TestAttributes(code, IsElement("Obsolete")) + End Function - Public Sub PropertySetAttribute_WithGet() + Public Async Function TestPropertySetAttribute_WithGet() As Task Dim code = public class Class1 @@ -285,12 +286,12 @@ public class Class1 } - TestAttributes(code, IsElement("Obsolete")) - End Sub + Await TestAttributes(code, IsElement("Obsolete")) + End Function - Public Sub Attribute_1() + Public Async Function TestAttribute_1() As Task Dim code = class Class2 @@ -303,14 +304,14 @@ class Class2 } - TestAttributes(code, IsElement("Obsolete")) - End Sub + Await TestAttributes(code, IsElement("Obsolete")) + End Function #End Region #Region "CanOverride tests" - Public Sub CanOverride1() + Public Async Function TestCanOverride1() As Task Dim code = abstract class C @@ -319,11 +320,11 @@ abstract class C } - TestCanOverride(code, True) - End Sub + Await TestCanOverride(code, True) + End Function - Public Sub CanOverride2() + Public Async Function TestCanOverride2() As Task Dim code = interface I @@ -332,11 +333,11 @@ interface I } - TestCanOverride(code, True) - End Sub + Await TestCanOverride(code, True) + End Function - Public Sub CanOverride3() + Public Async Function TestCanOverride3() As Task Dim code = class C @@ -345,11 +346,11 @@ class C } - TestCanOverride(code, True) - End Sub + Await TestCanOverride(code, True) + End Function - Public Sub CanOverride4() + Public Async Function TestCanOverride4() As Task Dim code = class C @@ -358,11 +359,11 @@ class C } - TestCanOverride(code, False) - End Sub + Await TestCanOverride(code, False) + End Function - Public Sub CanOverride5() + Public Async Function TestCanOverride5() As Task Dim code = class B @@ -381,15 +382,15 @@ class C : B } - TestCanOverride(code, False) - End Sub + Await TestCanOverride(code, False) + End Function #End Region #Region "FullName tests" - Public Sub FullName_Destructor() + Public Async Function TestFullName_Destructor() As Task Dim code = class C @@ -398,12 +399,12 @@ class C } - TestFullName(code, "C.~C") - End Sub + Await TestFullName(code, "C.~C") + End Function - Public Sub FullName_ExplicitlyImplementedMethod() + Public Async Function TestFullName_ExplicitlyImplementedMethod() As Task Dim code = public interface I1 @@ -420,12 +421,12 @@ public class C1 : I1 } - TestFullName(code, "C1.I1.f1") - End Sub + Await TestFullName(code, "C1.I1.f1") + End Function - Public Sub FullName_ImplicitOperator() + Public Async Function TestFullName_ImplicitOperator() As Task Dim code = public class ComplexType @@ -443,12 +444,12 @@ public class ComplexType } - TestFullName(code, "ComplexType.implicit operator ComplexType") - End Sub + Await TestFullName(code, "ComplexType.implicit operator ComplexType") + End Function - Public Sub FullName_ExplicitOperator() + Public Async Function TestFullName_ExplicitOperator() As Task Dim code = public class ComplexType @@ -466,12 +467,12 @@ public class ComplexType } - TestFullName(code, "ComplexType.explicit operator ComplexType") - End Sub + Await TestFullName(code, "ComplexType.explicit operator ComplexType") + End Function - Public Sub FullName_OperatorOverload() + Public Async Function TestFullName_OperatorOverload() As Task Dim code = public class ComplexType @@ -489,15 +490,15 @@ public class ComplexType } - TestFullName(code, "ComplexType.operator +") - End Sub + Await TestFullName(code, "ComplexType.operator +") + End Function #End Region #Region "FunctionKind tests" - Public Sub FunctionKind_Destructor() + Public Async Function TestFunctionKind_Destructor() As Task Dim code = class C @@ -506,11 +507,11 @@ class C } - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionDestructor) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionDestructor) + End Function - Public Sub FunctionKind_ExplicitInterfaceImplementation() + Public Async Function TestFunctionKind_ExplicitInterfaceImplementation() As Task Dim code = public interface I1 @@ -526,11 +527,11 @@ public class C1: I1 } - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionFunction) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionFunction) + End Function - Public Sub FunctionKind_Operator() + Public Async Function TestFunctionKind_Operator() As Task Dim code = public class C @@ -541,11 +542,11 @@ public class C } - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionOperator) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionOperator) + End Function - Public Sub FunctionKind_ExplicitConversion() + Public Async Function TestFunctionKind_ExplicitConversion() As Task Dim code = public class C @@ -556,11 +557,11 @@ public class C } - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionOperator) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionOperator) + End Function - Public Sub FunctionKind_ImplicitConversion() + Public Async Function TestFunctionKind_ImplicitConversion() As Task Dim code = public class C @@ -571,15 +572,15 @@ public class C } - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionOperator) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionOperator) + End Function #End Region #Region "MustImplement tests" - Public Sub MustImplement1() + Public Async Function TestMustImplement1() As Task Dim code = abstract class C @@ -588,11 +589,11 @@ abstract class C } - TestMustImplement(code, True) - End Sub + Await TestMustImplement(code, True) + End Function - Public Sub MustImplement2() + Public Async Function TestMustImplement2() As Task Dim code = interface I @@ -601,11 +602,11 @@ interface I } - TestMustImplement(code, True) - End Sub + Await TestMustImplement(code, True) + End Function - Public Sub MustImplement3() + Public Async Function TestMustImplement3() As Task Dim code = class C @@ -614,11 +615,11 @@ class C } - TestMustImplement(code, False) - End Sub + Await TestMustImplement(code, False) + End Function - Public Sub MustImplement4() + Public Async Function TestMustImplement4() As Task Dim code = class C @@ -627,11 +628,11 @@ class C } - TestMustImplement(code, False) - End Sub + Await TestMustImplement(code, False) + End Function - Public Sub MustImplement5() + Public Async Function TestMustImplement5() As Task Dim code = class B @@ -650,8 +651,8 @@ class C : B } - TestMustImplement(code, False) - End Sub + Await TestMustImplement(code, False) + End Function #End Region @@ -659,7 +660,7 @@ class C : B - Public Sub Name_ExplicitlyImplementedMethod() + Public Async Function TestName_ExplicitlyImplementedMethod() As Task Dim code = public interface I1 @@ -676,11 +677,11 @@ public class C1 : I1 } - TestName(code, "I1.f1") - End Sub + Await TestName(code, "I1.f1") + End Function - Public Sub Name_Destructor() + Public Async Function TestName_Destructor() As Task Dim code = class C @@ -689,12 +690,12 @@ class C } - TestName(code, "~C") - End Sub + Await TestName(code, "~C") + End Function - Public Sub Name_ImplicitOperator() + Public Async Function TestName_ImplicitOperator() As Task Dim code = public class ComplexType @@ -712,12 +713,12 @@ public class ComplexType } - TestName(code, "implicit operator ComplexType") - End Sub + Await TestName(code, "implicit operator ComplexType") + End Function - Public Sub Name_ExplicitOperator() + Public Async Function TestName_ExplicitOperator() As Task Dim code = public class ComplexType @@ -735,12 +736,12 @@ public class ComplexType } - TestName(code, "explicit operator ComplexType") - End Sub + Await TestName(code, "explicit operator ComplexType") + End Function - Public Sub Name_OperatorOverload() + Public Async Function TestName_OperatorOverload() As Task Dim code = public class ComplexType @@ -758,15 +759,15 @@ public class ComplexType } - TestName(code, "operator +") - End Sub + Await TestName(code, "operator +") + End Function #End Region #Region "OverrideKind tests" - Public Sub OverrideKind_Abstract() + Public Async Function TestOverrideKind_Abstract() As Task Dim code = abstract class C @@ -775,11 +776,11 @@ abstract class C } - TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) - End Sub + Await TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) + End Function - Public Sub OverrideKind_Virtual() + Public Async Function TestOverrideKind_Virtual() As Task Dim code = class C @@ -788,11 +789,11 @@ class C } - TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindVirtual) - End Sub + Await TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindVirtual) + End Function - Public Sub OverrideKind_Sealed() + Public Async Function TestOverrideKind_Sealed() As Task Dim code = class C @@ -801,11 +802,11 @@ class C } - TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindSealed) - End Sub + Await TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindSealed) + End Function - Public Sub OverrideKind_Override() + Public Async Function TestOverrideKind_Override() As Task Dim code = abstract class B @@ -819,11 +820,11 @@ class C : B } - TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindOverride) - End Sub + Await TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindOverride) + End Function - Public Sub OverrideKind_New() + Public Async Function TestOverrideKind_New() As Task Dim code = abstract class B @@ -837,15 +838,15 @@ class C : B } - TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNew) - End Sub + Await TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNew) + End Function #End Region #Region "Prototype tests" - Public Sub Prototype_FullNameOnly() + Public Async Function TestPrototype_FullNameOnly() As Task Dim code = class A @@ -857,11 +858,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "A.MethodC") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "A.MethodC") + End Function - Public Sub Prototype_UniqueSignature() + Public Async Function TestPrototype_UniqueSignature() As Task Dim code = class A @@ -873,11 +874,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature, "A.MethodC(int,bool)") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature, "A.MethodC(int,bool)") + End Function - Public Sub Prototype_ParamTypesOnly() + Public Async Function TestPrototype_ParamTypesOnly() As Task Dim code = class A @@ -889,11 +890,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeParamTypes, "MethodC (int, bool)") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeParamTypes, "MethodC (int, bool)") + End Function - Public Sub Prototype_ParamNamesOnly() + Public Async Function TestPrototype_ParamNamesOnly() As Task Dim code = class A @@ -905,11 +906,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeParamNames, "MethodC (intA, boolB)") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeParamNames, "MethodC (intA, boolB)") + End Function - Public Sub Prototype_ReturnType() + Public Async Function TestPrototype_ReturnType() As Task Dim code = class A @@ -921,11 +922,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "bool MethodC") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "bool MethodC") + End Function - Public Sub Prototype_ClassName1() + Public Async Function TestPrototype_ClassName1() As Task Dim code = class A @@ -937,11 +938,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "A.MethodC") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "A.MethodC") + End Function - Public Sub Prototype_ClassName2() + Public Async Function TestPrototype_ClassName2() As Task Dim code = class A<T> @@ -953,11 +954,11 @@ class A<T> } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "A<>.MethodC") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "A<>.MethodC") + End Function - Public Sub Prototype_ClassName3() + Public Async Function TestPrototype_ClassName3() As Task Dim code = class C<T> @@ -972,11 +973,11 @@ class C<T> } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C<>.A.MethodC") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C<>.A.MethodC") + End Function - Public Sub Prototype_ClassName4() + Public Async Function TestPrototype_ClassName4() As Task Dim code = class C @@ -991,11 +992,11 @@ class C } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.A<>.MethodC") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.A<>.MethodC") + End Function - Public Sub Prototype_ClassName5() + Public Async Function TestPrototype_ClassName5() As Task Dim code = class C @@ -1010,11 +1011,11 @@ class C } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.A.MethodC") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.A.MethodC") + End Function - Public Sub Prototype_ClassName6() + Public Async Function TestPrototype_ClassName6() As Task Dim code = namespace N @@ -1029,11 +1030,11 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "A.MethodC") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "A.MethodC") + End Function - Public Sub Prototype_Constructor_Unique() + Public Async Function TestPrototype_Constructor_Unique() As Task Dim code = class A @@ -1044,11 +1045,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature, "A.#ctor()") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature, "A.#ctor()") + End Function - Public Sub Prototype_Finalizer_Unique() + Public Async Function TestPrototype_Finalizer_Unique() As Task Dim code = class A @@ -1059,11 +1060,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature, "A.#dtor()") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature, "A.#dtor()") + End Function - Public Sub Prototype_Unique_InvalidCombination() + Public Async Function TestPrototype_Unique_InvalidCombination() As Task Dim code = class A @@ -1075,11 +1076,11 @@ class A } - TestPrototypeThrows(Of ArgumentException)(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature Or EnvDTE.vsCMPrototype.vsCMPrototypeClassName) - End Sub + Await TestPrototypeThrows(Of ArgumentException)(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature Or EnvDTE.vsCMPrototype.vsCMPrototypeClassName) + End Function - Public Sub Prototype_Constructor_FullName() + Public Async Function TestPrototype_Constructor_FullName() As Task Dim code = class A @@ -1090,11 +1091,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "A.A") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "A.A") + End Function - Public Sub Prototype_Finalizer_FullName() + Public Async Function TestPrototype_Finalizer_FullName() As Task Dim code = class A @@ -1105,11 +1106,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "A.~A") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "A.~A") + End Function - Public Sub Prototype_Operator_FullName() + Public Async Function TestPrototype_Operator_FullName() As Task Dim code = class A @@ -1121,11 +1122,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "A.operator +") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "A.operator +") + End Function - Public Sub Prototype_Constructor_ReturnType() + Public Async Function TestPrototype_Constructor_ReturnType() As Task Dim code = class A @@ -1136,11 +1137,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "void A") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "void A") + End Function - Public Sub Prototype_Finalizer_ReturnType() + Public Async Function TestPrototype_Finalizer_ReturnType() As Task Dim code = class A @@ -1151,11 +1152,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "void ~A") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "void ~A") + End Function - Public Sub Prototype_Operator_ReturnType() + Public Async Function TestPrototype_Operator_ReturnType() As Task Dim code = class A @@ -1167,11 +1168,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "A operator +") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "A operator +") + End Function - Public Sub Prototype_Constructor_ClassName() + Public Async Function TestPrototype_Constructor_ClassName() As Task Dim code = class A @@ -1182,11 +1183,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "A.A") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "A.A") + End Function - Public Sub Prototype_Finalizer_ClassName() + Public Async Function TestPrototype_Finalizer_ClassName() As Task Dim code = class A @@ -1197,11 +1198,11 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "A.~A") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "A.~A") + End Function - Public Sub Prototype_Operator_ClassName() + Public Async Function TestPrototype_Operator_ClassName() As Task Dim code = class A @@ -1213,15 +1214,15 @@ class A } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "A.operator +") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "A.operator +") + End Function #End Region #Region "Type tests" - Public Sub Type_Constructor() + Public Async Function TestType_Constructor() As Task Dim code = class A @@ -1232,7 +1233,7 @@ class A } - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsFullName = "System.Void", @@ -1240,10 +1241,10 @@ class A .CodeTypeFullName = "System.Void", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefVoid }) - End Sub + End Function - Public Sub Type_Finalizer() + Public Async Function TestType_Finalizer() As Task Dim code = class A @@ -1254,7 +1255,7 @@ class A } - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsFullName = "System.Void", @@ -1262,10 +1263,10 @@ class A .CodeTypeFullName = "System.Void", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefVoid }) - End Sub + End Function - Public Sub Type_Operator() + Public Async Function TestType_Operator() As Task Dim code = class A @@ -1277,7 +1278,7 @@ class A } - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsFullName = "A", @@ -1285,13 +1286,13 @@ class A .CodeTypeFullName = "A", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType }) - End Sub + End Function #End Region #Region "RemoveParameter tests" - Public Sub RemoveParameter1() + Public Async Function TestRemoveParameter1() As Task Dim code = class C @@ -1308,11 +1309,11 @@ class C } - TestRemoveChild(code, expected, "a") - End Sub + Await TestRemoveChild(code, expected, "a") + End Function - Public Sub RemoveParameter2() + Public Async Function TestRemoveParameter2() As Task Dim code = class C @@ -1329,11 +1330,11 @@ class C } - TestRemoveChild(code, expected, "b") - End Sub + Await TestRemoveChild(code, expected, "b") + End Function - Public Sub RemoveParameter3() + Public Async Function TestRemoveParameter3() As Task Dim code = class C @@ -1350,11 +1351,11 @@ class C } - TestRemoveChild(code, expected, "a") - End Sub + Await TestRemoveChild(code, expected, "a") + End Function - Public Sub RemoveParameter4() + Public Async Function TestRemoveParameter4() As Task Dim code = class C @@ -1371,14 +1372,14 @@ class C } - TestRemoveChild(code, expected, "b") - End Sub + Await TestRemoveChild(code, expected, "b") + End Function #End Region #Region "AddParameter tests" - Public Sub AddParameter1() + Public Async Function TestAddParameter1() As Task Dim code = class C @@ -1395,11 +1396,11 @@ class C } - TestAddParameter(code, expected, New ParameterData With {.Name = "a", .Type = "int"}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "a", .Type = "int"}) + End Function - Public Sub AddParameter2() + Public Async Function TestAddParameter2() As Task Dim code = class C @@ -1416,11 +1417,11 @@ class C } - TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "string"}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "string"}) + End Function - Public Sub AddParameter3() + Public Async Function TestAddParameter3() As Task Dim code = class C @@ -1437,11 +1438,11 @@ class C } - TestAddParameter(code, expected, New ParameterData With {.Name = "c", .Type = "System.Boolean", .Position = 1}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "c", .Type = "System.Boolean", .Position = 1}) + End Function - Public Sub AddParameter4() + Public Async Function TestAddParameter4() As Task Dim code = class C @@ -1458,14 +1459,14 @@ class C } - TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "string", .Position = -1}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "string", .Position = -1}) + End Function #End Region #Region "Set Access tests" - Public Sub SetAccess1() + Public Async Function TestSetAccess1() As Task Dim code = class C @@ -1488,11 +1489,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetAccess2() + Public Async Function TestSetAccess2() As Task Dim code = class C @@ -1515,11 +1516,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub SetAccess3() + Public Async Function TestSetAccess3() As Task Dim code = class C @@ -1542,11 +1543,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetAccess4() + Public Async Function TestSetAccess4() As Task Dim code = class C @@ -1569,11 +1570,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub SetAccess5() + Public Async Function TestSetAccess5() As Task Dim code = class C @@ -1596,11 +1597,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetAccess6() + Public Async Function TestSetAccess6() As Task Dim code = interface I @@ -1617,11 +1618,11 @@ interface I } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProtected, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProtected, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) + End Function - Public Sub SetAccess7() + Public Async Function TestSetAccess7() As Task Dim code = interface I @@ -1638,15 +1639,15 @@ interface I } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function #End Region #Region "Set IsShared tests" - Public Sub SetIsShared1() + Public Async Function TestSetIsShared1() As Task Dim code = class C @@ -1667,11 +1668,11 @@ class C } - TestSetIsShared(code, expected, True) - End Sub + Await TestSetIsShared(code, expected, True) + End Function - Public Sub SetIsShared2() + Public Async Function TestSetIsShared2() As Task Dim code = class C @@ -1692,11 +1693,11 @@ class C } - TestSetIsShared(code, expected, False) - End Sub + Await TestSetIsShared(code, expected, False) + End Function - Public Sub SetIsShared3() + Public Async Function TestSetIsShared3() As Task Dim code = class C @@ -1717,11 +1718,11 @@ class C } - TestSetIsShared(code, expected, True) - End Sub + Await TestSetIsShared(code, expected, True) + End Function - Public Sub SetIsShared4() + Public Async Function TestSetIsShared4() As Task Dim code = class C @@ -1742,15 +1743,15 @@ class C } - TestSetIsShared(code, expected, False) - End Sub + Await TestSetIsShared(code, expected, False) + End Function #End Region #Region "Set CanOverride tests" - Public Sub SetCanOverride1() + Public Async Function TestSetCanOverride1() As Task Dim code = class C @@ -1771,11 +1772,11 @@ class C } - TestSetCanOverride(code, expected, True) - End Sub + Await TestSetCanOverride(code, expected, True) + End Function - Public Sub SetCanOverride2() + Public Async Function TestSetCanOverride2() As Task Dim code = class C @@ -1796,11 +1797,11 @@ class C } - TestSetCanOverride(code, expected, True) - End Sub + Await TestSetCanOverride(code, expected, True) + End Function - Public Sub SetCanOverride3() + Public Async Function TestSetCanOverride3() As Task Dim code = class C @@ -1821,11 +1822,11 @@ class C } - TestSetCanOverride(code, expected, False) - End Sub + Await TestSetCanOverride(code, expected, False) + End Function - Public Sub SetCanOverride4() + Public Async Function TestSetCanOverride4() As Task Dim code = class C @@ -1846,11 +1847,11 @@ class C } - TestSetCanOverride(code, expected, False) - End Sub + Await TestSetCanOverride(code, expected, False) + End Function - Public Sub SetCanOverride5() + Public Async Function TestSetCanOverride5() As Task Dim code = interface I @@ -1867,11 +1868,11 @@ interface I } - TestSetCanOverride(code, expected, True) - End Sub + Await TestSetCanOverride(code, expected, True) + End Function - Public Sub SetCanOverride6() + Public Async Function TestSetCanOverride6() As Task Dim code = interface I @@ -1888,15 +1889,15 @@ interface I } - TestSetCanOverride(code, expected, False, ThrowsArgumentException(Of Boolean)) - End Sub + Await TestSetCanOverride(code, expected, False, ThrowsArgumentException(Of Boolean)) + End Function #End Region #Region "Set MustImplement tests" - Public Sub SetMustImplement1() + Public Async Function TestSetMustImplement1() As Task Dim code = abstract class C @@ -1915,11 +1916,11 @@ abstract class C } - TestSetMustImplement(code, expected, True) - End Sub + Await TestSetMustImplement(code, expected, True) + End Function - Public Sub SetMustImplement2() + Public Async Function TestSetMustImplement2() As Task Dim code = abstract class C @@ -1942,11 +1943,11 @@ abstract class C } - TestSetMustImplement(code, expected, True) - End Sub + Await TestSetMustImplement(code, expected, True) + End Function - Public Sub SetMustImplement3() + Public Async Function TestSetMustImplement3() As Task Dim code = abstract class C @@ -1966,11 +1967,11 @@ abstract class C } - TestSetMustImplement(code, expected, False) - End Sub + Await TestSetMustImplement(code, expected, False) + End Function - Public Sub SetMustImplement4() + Public Async Function TestSetMustImplement4() As Task Dim code = abstract class C @@ -1987,11 +1988,11 @@ abstract class C } - TestSetMustImplement(code, expected, True) - End Sub + Await TestSetMustImplement(code, expected, True) + End Function - Public Sub SetMustImplement5() + Public Async Function TestSetMustImplement5() As Task Dim code = abstract class C @@ -2012,11 +2013,11 @@ abstract class C } - TestSetMustImplement(code, expected, False) - End Sub + Await TestSetMustImplement(code, expected, False) + End Function - Public Sub SetMustImplement6() + Public Async Function TestSetMustImplement6() As Task Dim code = class C @@ -2037,11 +2038,11 @@ class C } - TestSetMustImplement(code, expected, True, ThrowsArgumentException(Of Boolean)) - End Sub + Await TestSetMustImplement(code, expected, True, ThrowsArgumentException(Of Boolean)) + End Function - Public Sub SetMustImplement7() + Public Async Function TestSetMustImplement7() As Task Dim code = class C @@ -2062,11 +2063,11 @@ class C } - TestSetMustImplement(code, expected, False) - End Sub + Await TestSetMustImplement(code, expected, False) + End Function - Public Sub SetMustImplement8() + Public Async Function TestSetMustImplement8() As Task Dim code = interface I @@ -2087,11 +2088,11 @@ interface I } - TestSetMustImplement(code, expected, False, ThrowsArgumentException(Of Boolean)) - End Sub + Await TestSetMustImplement(code, expected, False, ThrowsArgumentException(Of Boolean)) + End Function - Public Sub SetMustImplement9() + Public Async Function TestSetMustImplement9() As Task Dim code = interface I @@ -2112,15 +2113,15 @@ interface I } - TestSetMustImplement(code, expected, True) - End Sub + Await TestSetMustImplement(code, expected, True) + End Function #End Region #Region "Set OverrideKind tests" - Public Sub SetOverrideKind1() + Public Async Function TestSetOverrideKind1() As Task Dim code = class C @@ -2141,11 +2142,11 @@ class C } - TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindVirtual) - End Sub + Await TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindVirtual) + End Function - Public Sub SetOverrideKind2() + Public Async Function TestSetOverrideKind2() As Task Dim code = class C @@ -2166,11 +2167,11 @@ class C } - TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindSealed) - End Sub + Await TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindSealed) + End Function - Public Sub SetOverrideKind3() + Public Async Function TestSetOverrideKind3() As Task Dim code = abstract class C @@ -2189,15 +2190,15 @@ abstract class C } - TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) - End Sub + Await TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = class C @@ -2218,15 +2219,15 @@ class C } - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region #Region "Set Type tests" - Public Sub SetType1() + Public Async Function TestSetType1() As Task Dim code = class C @@ -2247,15 +2248,15 @@ class C } - TestSetTypeProp(code, expected, "System.Int32") - End Sub + Await TestSetTypeProp(code, expected, "System.Int32") + End Function #End Region #Region "ExtensionMethodExtender" - Public Sub ExtensionMethodExtender_IsExtension1() + Public Async Function TestExtensionMethodExtender_IsExtension1() As Task Dim code = public static class C @@ -2266,11 +2267,11 @@ public static class C } - TestExtensionMethodExtender_IsExtension(code, True) - End Sub + Await TestExtensionMethodExtender_IsExtension(code, True) + End Function - Public Sub ExtensionMethodExtender_IsExtension2() + Public Async Function TestExtensionMethodExtender_IsExtension2() As Task Dim code = public static class C @@ -2281,15 +2282,15 @@ public static class C } - TestExtensionMethodExtender_IsExtension(code, False) - End Sub + Await TestExtensionMethodExtender_IsExtension(code, False) + End Function #End Region #Region "PartialMethodExtender" - Public Sub PartialMethodExtender_IsPartial1() + Public Async Function TestPartialMethodExtender_IsPartial1() As Task Dim code = public partial class C @@ -2306,11 +2307,11 @@ public partial class C } - TestPartialMethodExtender_IsPartial(code, True) - End Sub + Await TestPartialMethodExtender_IsPartial(code, True) + End Function - Public Sub PartialMethodExtender_IsPartial2() + Public Async Function TestPartialMethodExtender_IsPartial2() As Task Dim code = public partial class C @@ -2327,11 +2328,11 @@ public partial class C } - TestPartialMethodExtender_IsPartial(code, True) - End Sub + Await TestPartialMethodExtender_IsPartial(code, True) + End Function - Public Sub PartialMethodExtender_IsPartial3() + Public Async Function TestPartialMethodExtender_IsPartial3() As Task Dim code = public partial class C @@ -2348,11 +2349,11 @@ public partial class C } - TestPartialMethodExtender_IsPartial(code, False) - End Sub + Await TestPartialMethodExtender_IsPartial(code, False) + End Function - Public Sub PartialMethodExtender_IsDeclaration1() + Public Async Function TestPartialMethodExtender_IsDeclaration1() As Task Dim code = public partial class C @@ -2369,11 +2370,11 @@ public partial class C } - TestPartialMethodExtender_IsDeclaration(code, True) - End Sub + Await TestPartialMethodExtender_IsDeclaration(code, True) + End Function - Public Sub PartialMethodExtender_IsDeclaration2() + Public Async Function TestPartialMethodExtender_IsDeclaration2() As Task Dim code = public partial class C @@ -2390,11 +2391,11 @@ public partial class C } - TestPartialMethodExtender_IsDeclaration(code, False) - End Sub + Await TestPartialMethodExtender_IsDeclaration(code, False) + End Function - Public Sub PartialMethodExtender_IsDeclaration3() + Public Async Function TestPartialMethodExtender_IsDeclaration3() As Task Dim code = public partial class C @@ -2411,11 +2412,11 @@ public partial class C } - TestPartialMethodExtender_IsDeclaration(code, False) - End Sub + Await TestPartialMethodExtender_IsDeclaration(code, False) + End Function - Public Sub PartialMethodExtender_HasOtherPart1() + Public Async Function TestPartialMethodExtender_HasOtherPart1() As Task Dim code = public partial class C @@ -2432,11 +2433,11 @@ public partial class C } - TestPartialMethodExtender_HasOtherPart(code, True) - End Sub + Await TestPartialMethodExtender_HasOtherPart(code, True) + End Function - Public Sub PartialMethodExtender_HasOtherPart2() + Public Async Function TestPartialMethodExtender_HasOtherPart2() As Task Dim code = public partial class C @@ -2453,11 +2454,11 @@ public partial class C } - TestPartialMethodExtender_HasOtherPart(code, True) - End Sub + Await TestPartialMethodExtender_HasOtherPart(code, True) + End Function - Public Sub PartialMethodExtender_HasOtherPart3() + Public Async Function TestPartialMethodExtender_HasOtherPart3() As Task Dim code = public partial class C @@ -2474,11 +2475,11 @@ public partial class C } - TestPartialMethodExtender_HasOtherPart(code, False) - End Sub + Await TestPartialMethodExtender_HasOtherPart(code, False) + End Function - Public Sub PartialMethodExtender_HasOtherPart4() + Public Async Function TestPartialMethodExtender_HasOtherPart4() As Task Dim code = public partial class C @@ -2487,15 +2488,15 @@ public partial class C } - TestPartialMethodExtender_HasOtherPart(code, False) - End Sub + Await TestPartialMethodExtender_HasOtherPart(code, False) + End Function #End Region #Region "Overloads Tests" - Public Sub TestOverloads1() + Public Async Function TestOverloads1() As Task Dim code = public static class C @@ -2509,11 +2510,11 @@ public static class C } } - TestOverloadsUniqueSignatures(code, "C.Foo()", "C.Foo(C)") - End Sub + Await TestOverloadsUniqueSignatures(code, "C.Foo()", "C.Foo(C)") + End Function - Public Sub TestOverloads2() + Public Async Function TestOverloads2() As Task Dim code = public static class C @@ -2523,11 +2524,11 @@ public static class C } } - TestOverloadsUniqueSignatures(code, "C.Foo()") - End Sub + Await TestOverloadsUniqueSignatures(code, "C.Foo()") + End Function - Public Sub TestOverloads3() + Public Async Function TestOverloads3() As Task Dim code = class A @@ -2538,8 +2539,8 @@ class A } } - TestOverloadsUniqueSignatures(code, "A.#op_Plus(A,A)") - End Sub + Await TestOverloadsUniqueSignatures(code, "A.#op_Plus(A,A)") + End Function #End Region @@ -2547,7 +2548,7 @@ class A - Public Sub TestParameterNameWithEscapeCharacters() + Public Async Function TestParameterNameWithEscapeCharacters() As Task Dim code = public class C @@ -2557,12 +2558,12 @@ public class C } } - TestAllParameterNames(code, "@int") - End Sub + Await TestAllParameterNames(code, "@int") + End Function - Public Sub TestParameterNameWithEscapeCharacters_2() + Public Async Function TestParameterNameWithEscapeCharacters_2() As Task Dim code = public class C @@ -2572,14 +2573,14 @@ public class C } } - TestAllParameterNames(code, "@int", "@string") - End Sub + Await TestAllParameterNames(code, "@int", "@string") + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = using System; @@ -2600,11 +2601,11 @@ class C void M() { } } - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = using System; @@ -2627,12 +2628,12 @@ class C void M() { } } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment() + Public Async Function TestAddAttribute_BelowDocComment() As Task Dim code = using System; @@ -2655,13 +2656,13 @@ class C void M() { } } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) + End Function #End Region - Public Sub TypeDescriptor_GetProperties() + Public Async Function TestTypeDescriptor_GetProperties() As Task Dim code = class C @@ -2677,8 +2678,8 @@ class C "IsShared", "MustImplement", "Overloads", "Attributes", "DocComment", "Comment", "CanOverride", "OverrideKind", "IsGeneric"} - TestPropertyDescriptors(code, expectedPropertyNames) - End Sub + Await TestPropertyDescriptors(code, expectedPropertyNames) + End Function Private Function GetExtensionMethodExtender(codeElement As EnvDTE80.CodeFunction2) As ICSExtensionMethodExtender Return CType(codeElement.Extender(ExtenderNames.ExtensionMethod), ICSExtensionMethodExtender) diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeImportTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeImportTests.vb index 08f358a8c6c0bc37021d14fdc1c845de1da6592f..b31e74dbef5a2a79b8a75c4b4006908406c8d3c4 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeImportTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeImportTests.vb @@ -1,6 +1,7 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. Imports System.Runtime.InteropServices +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -11,55 +12,55 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "FullName tests" - Public Sub FullName1() + Public Async Function TestFullName1() As Task Dim code = using $$Foo; - Dim ex = Assert.Throws(Of COMException)( - Sub() - TestName(code, "Foo") - End Sub) + Dim ex = Await Assert.ThrowsAsync(Of COMException)( + Async Function() + Await TestName(code, "Foo") + End Function) Assert.Equal(E_FAIL, ex.ErrorCode) - End Sub + End Function #End Region #Region "Name tests" - Public Sub Name1() + Public Async Function TestName1() As Task Dim code = using $$Foo; - Dim ex = Assert.Throws(Of COMException)( - Sub() - TestName(code, "Foo") - End Sub) + Dim ex = Await Assert.ThrowsAsync(Of COMException)( + Async Function() + Await TestName(code, "Foo") + End Function) Assert.Equal(E_FAIL, ex.ErrorCode) - End Sub + End Function #End Region #Region "Namespace tests" - Public Sub Namespace1() + Public Async Function TestNamespace1() As Task Dim code = using $$Foo; - TestNamespace(code, "Foo") - End Sub + Await TestNamespace(code, "Foo") + End Function - Public Sub Namespace2() + Public Async Function TestNamespace2() As Task Dim code = namespace Bar @@ -68,13 +69,13 @@ namespace Bar } - TestNamespace(code, "Foo") - End Sub + Await TestNamespace(code, "Foo") + End Function #End Region - Public Sub TypeDescriptor_GetProperties() + Public Async Function TestTypeDescriptor_GetProperties() As Task Dim code = using $$System; @@ -85,8 +86,8 @@ using $$System; "InfoLocation", "Children", "Language", "StartPoint", "EndPoint", "ExtenderNames", "ExtenderCATID", "Namespace", "Alias", "Parent"} - TestPropertyDescriptors(code, expectedPropertyNames) - End Sub + Await TestPropertyDescriptors(code, expectedPropertyNames) + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeInterfaceTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeInterfaceTests.vb index b74d3580c3df4fa43c8b4d26d27480f40e54d718..e2e3573214fed19af03dd55427d877e1092622d9 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeInterfaceTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeInterfaceTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,51 +11,51 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "Access tests" - Public Sub Access1() + Public Async Function TestAccess1() As Task Dim code = interface $$I { } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access2() + Public Async Function TestAccess2() As Task Dim code = internal interface $$I { } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access3() + Public Async Function TestAccess3() As Task Dim code = public interface $$I { } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function #End Region #Region "Attributes tests" - Public Sub Attributes1() + Public Async Function TestAttributes1() As Task Dim code = interface $$C { } - TestAttributes(code, NoElements) - End Sub + Await TestAttributes(code, NoElements) + End Function - Public Sub Attributes2() + Public Async Function TestAttributes2() As Task Dim code = using System; @@ -63,11 +64,11 @@ using System; interface $$C { } - TestAttributes(code, IsElement("Serializable")) - End Sub + Await TestAttributes(code, IsElement("Serializable")) + End Function - Public Sub Attributes3() + Public Async Function TestAttributes3() As Task Dim code = using System; @@ -76,11 +77,11 @@ interface $$C { } interface $$C { } - TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) - End Sub + Await TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) + End Function - Public Sub Attributes4() + Public Async Function TestAttributes4() As Task Dim code = using System; @@ -88,13 +89,13 @@ interface $$C { } interface $$C { } - TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) - End Sub + Await TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) + End Function #End Region #Region "Parts tests" - Public Sub Parts1() + Public Async Function TestParts1() As Task Dim code = interface $$I @@ -102,11 +103,11 @@ interface $$I } - TestParts(code, 1) - End Sub + Await TestParts(code, 1) + End Function - Public Sub Parts2() + Public Async Function TestParts2() As Task Dim code = partial interface $$I @@ -114,11 +115,11 @@ partial interface $$I } - TestParts(code, 1) - End Sub + Await TestParts(code, 1) + End Function - Public Sub Parts3() + Public Async Function TestParts3() As Task Dim code = partial interface $$I @@ -130,13 +131,13 @@ partial interface I } - TestParts(code, 2) - End Sub + Await TestParts(code, 2) + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = using System; @@ -151,11 +152,11 @@ using System; [Serializable()] interface I { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = using System; @@ -172,12 +173,12 @@ using System; [CLSCompliant(true)] interface I { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment() + Public Async Function TestAddAttribute_BelowDocComment() As Task Dim code = using System; @@ -194,15 +195,15 @@ using System; [CLSCompliant(true)] interface I { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) + End Function #End Region #Region "AddBase tests" - Public Sub AddBase1() + Public Async Function TestAddBase1() As Task Dim code = interface $$I { } @@ -212,11 +213,11 @@ interface $$I { } interface I : B { } - TestAddBase(code, "B", Nothing, expected) - End Sub + Await TestAddBase(code, "B", Nothing, expected) + End Function - Public Sub AddBase2() + Public Async Function TestAddBase2() As Task Dim code = interface $$I : B { } @@ -226,11 +227,11 @@ interface $$I : B { } interface I : A, B { } - TestAddBase(code, "A", Nothing, expected) - End Sub + Await TestAddBase(code, "A", Nothing, expected) + End Function - Public Sub AddBase3() + Public Async Function TestAddBase3() As Task Dim code = interface $$I : B { } @@ -240,11 +241,11 @@ interface $$I : B { } interface I : B, A { } - TestAddBase(code, "A", Type.Missing, expected) - End Sub + Await TestAddBase(code, "A", Type.Missing, expected) + End Function - Public Sub AddBase4() + Public Async Function TestAddBase4() As Task Dim code = interface $$I : B { } @@ -254,11 +255,11 @@ interface $$I : B { } interface I : B, A { } - TestAddBase(code, "A", -1, expected) - End Sub + Await TestAddBase(code, "A", -1, expected) + End Function - Public Sub AddBase5() + Public Async Function TestAddBase5() As Task Dim code = interface $$I : B { } @@ -268,11 +269,11 @@ interface $$I : B { } interface I : A, B { } - TestAddBase(code, "A", 0, expected) - End Sub + Await TestAddBase(code, "A", 0, expected) + End Function - Public Sub AddBase6() + Public Async Function TestAddBase6() As Task Dim code = interface $$I @@ -286,15 +287,15 @@ interface I : B { } - TestAddBase(code, "B", Nothing, expected) - End Sub + Await TestAddBase(code, "B", Nothing, expected) + End Function #End Region #Region "AddEvent tests" - Public Sub AddEvent1() + Public Async Function TestAddEvent1() As Task Dim code = interface $$I @@ -310,11 +311,11 @@ interface I } - TestAddEvent(code, expected, New EventData With {.Name = "E", .FullDelegateName = "System.EventHandler"}) - End Sub + Await TestAddEvent(code, expected, New EventData With {.Name = "E", .FullDelegateName = "System.EventHandler"}) + End Function - Public Sub AddEvent2() + Public Async Function TestAddEvent2() As Task Dim code = interface $$I @@ -331,15 +332,15 @@ interface I ' Note: C# Code Model apparently ignore CreatePropertyStyleEvent for interfaces in Dev10. - TestAddEvent(code, expected, New EventData With {.Name = "E", .FullDelegateName = "System.EventHandler", .CreatePropertyStyleEvent = True}) - End Sub + Await TestAddEvent(code, expected, New EventData With {.Name = "E", .FullDelegateName = "System.EventHandler", .CreatePropertyStyleEvent = True}) + End Function #End Region #Region "AddFunction tests" - Public Sub AddFunction1() + Public Async Function TestAddFunction1() As Task Dim code = interface $$I { } @@ -353,15 +354,15 @@ interface I } - TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "void"}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "void"}) + End Function #End Region #Region "RemoveBase tests" - Public Sub RemoveBase1() + Public Async Function TestRemoveBase1() As Task Dim code = interface $$I : B { } @@ -371,11 +372,11 @@ interface $$I : B { } interface I { } - TestRemoveBase(code, "B", expected) - End Sub + Await TestRemoveBase(code, "B", expected) + End Function - Public Sub RemoveBase2() + Public Async Function TestRemoveBase2() As Task Dim code = interface $$I : A, B { } @@ -385,14 +386,14 @@ interface $$I : A, B { } interface I : B { } - TestRemoveBase(code, "A", expected) - End Sub + Await TestRemoveBase(code, "A", expected) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = interface $$Foo @@ -407,12 +408,12 @@ interface Bar } - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region - Public Sub TypeDescriptor_GetProperties() + Public Async Function TestTypeDescriptor_GetProperties() As Task Dim code = interface $$I @@ -426,8 +427,8 @@ interface $$I "ExtenderCATID", "Parent", "Namespace", "Bases", "Members", "Access", "Attributes", "DocComment", "Comment", "DerivedTypes", "IsGeneric", "DataTypeKind", "Parts"} - TestPropertyDescriptors(code, expectedPropertyNames) - End Sub + Await TestPropertyDescriptors(code, expectedPropertyNames) + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeNamespaceTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeNamespaceTests.vb index 152576a44a9206e4d939cd2f377b6aaa622fd6a1..1550acf8abbc88c9cc3ad37fefd76f482b75924d 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeNamespaceTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeNamespaceTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -11,7 +12,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "Remove tests" - Public Sub Remove1() + Public Async Function TestRemove1() As Task Dim code = namespace $$Foo @@ -29,14 +30,14 @@ namespace Foo } - TestRemoveChild(code, expected, "C") - End Sub + Await TestRemoveChild(code, expected, "C") + End Function #End Region - Public Sub Children1() + Public Async Function TestChildren1() As Task Dim code = namespace N$$ @@ -47,14 +48,14 @@ namespace N$$ } - TestChildren(code, + Await TestChildren(code, IsElement("C1", EnvDTE.vsCMElement.vsCMElementClass), IsElement("C2", EnvDTE.vsCMElement.vsCMElementClass), IsElement("C3", EnvDTE.vsCMElement.vsCMElementClass)) - End Sub + End Function - Public Sub TypeDescriptor_GetProperties() + Public Async Function TestTypeDescriptor_GetProperties() As Task Dim code = namespace $$N @@ -67,8 +68,8 @@ namespace $$N "InfoLocation", "Children", "Language", "StartPoint", "EndPoint", "ExtenderNames", "ExtenderCATID", "Parent", "Members", "DocComment", "Comment"} - TestPropertyDescriptors(code, expectedPropertyNames) - End Sub + Await TestPropertyDescriptors(code, expectedPropertyNames) + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeParameterTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeParameterTests.vb index b5b152670c3e6f2526e7013414485652be8b8b50..8a1cccdd0c8cbc4cff4ce477e41f04b2045dff3a 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeParameterTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeParameterTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,7 +11,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = class C @@ -30,11 +31,11 @@ class C } } - TestAddAttribute(code, expected, New AttributeData With {.Name = "Out"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Out"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = class C @@ -54,13 +55,13 @@ class C } } - TestAddAttribute(code, expected, New AttributeData With {.Name = "Foo"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Foo"}) + End Function #End Region #Region "DefaultValue tests" - Public Sub DefaultValue() + Public Async Function TestDefaultValue1() As Task Dim code = class C @@ -69,11 +70,11 @@ class C } - TestDefaultValue(code, """Foo""") - End Sub + Await TestDefaultValue(code, """Foo""") + End Function - Public Sub DefaultValue_ExternalCodeParameter_NoDefaultValue() + Public Async Function TestDefaultValue_ExternalCodeParameter_NoDefaultValue() As Task Dim code = class C : System.Console @@ -81,7 +82,7 @@ class C : System.Console void M(string $$s = "Foo") { } } - TestElement(code, + Await TestElement(code, Sub(codeParameter) Dim method = TryCast(codeParameter.Parent, EnvDTE80.CodeFunction2) Assert.NotNull(method) @@ -97,14 +98,14 @@ class C : System.Console Dim defaultValue = CType(method2.Parameters.Item(1), EnvDTE80.CodeParameter2).DefaultValue End Sub) - End Sub + End Function #End Region #Region "FullName tests" - Public Sub FullName() + Public Async Function TestFullName1() As Task Dim code = class C @@ -115,15 +116,15 @@ class C } - TestFullName(code, "s") - End Sub + Await TestFullName(code, "s") + End Function #End Region #Region "Kind tests" - Public Sub Kind() + Public Async Function TestKind1() As Task Dim code = class C @@ -134,14 +135,14 @@ class C } - TestKind(code, EnvDTE.vsCMElement.vsCMElementParameter) - End Sub + Await TestKind(code, EnvDTE.vsCMElement.vsCMElementParameter) + End Function #End Region #Region "ParameterKind tests" - Public Sub ParameterKind_None() + Public Async Function TestParameterKind_None() As Task Dim code = class C @@ -152,11 +153,11 @@ class C } - TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindNone) - End Sub + Await TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindNone) + End Function - Public Sub ParameterKind_Ref() + Public Async Function TestParameterKind_Ref() As Task Dim code = class C @@ -167,12 +168,12 @@ class C } - TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindRef) - End Sub + Await TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindRef) + End Function - Public Sub ParameterKind_Out() + Public Async Function TestParameterKind_Out() As Task Dim code = class C @@ -183,11 +184,11 @@ class C } - TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindOut) - End Sub + Await TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindOut) + End Function - Public Sub ParameterKind_ParamArray() + Public Async Function TestParameterKind_ParamArray() As Task Dim code = class C @@ -198,11 +199,11 @@ class C } - TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindParamArray) - End Sub + Await TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindParamArray) + End Function - Public Sub ParameterKind_Optional() + Public Async Function TestParameterKind_Optional() As Task Dim code = class C @@ -213,11 +214,11 @@ class C } - TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional) - End Sub + Await TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional) + End Function - Public Sub ParameterKind_OptionalAndRef() + Public Async Function TestParameterKind_OptionalAndRef() As Task Dim code = class C @@ -228,14 +229,14 @@ class C } - TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional Or EnvDTE80.vsCMParameterKind.vsCMParameterKindRef) - End Sub + Await TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional Or EnvDTE80.vsCMParameterKind.vsCMParameterKindRef) + End Function #End Region #Region "Parent tests" - Public Sub Parent1() + Public Async Function TestParent1() As Task Dim code = class C @@ -246,21 +247,21 @@ class C } - TestParent(code, IsElement("M", kind:=EnvDTE.vsCMElement.vsCMElementFunction)) - End Sub + Await TestParent(code, IsElement("M", kind:=EnvDTE.vsCMElement.vsCMElementFunction)) + End Function - Public Sub Parent2() + Public Async Function TestParent2() As Task Dim code = delegate void Foo(int $$i); - TestParent(code, IsElement("Foo", kind:=EnvDTE.vsCMElement.vsCMElementDelegate)) - End Sub + Await TestParent(code, IsElement("Foo", kind:=EnvDTE.vsCMElement.vsCMElementDelegate)) + End Function - Public Sub Parent3() + Public Async Function TestParent3() As Task Dim code = class C @@ -272,15 +273,15 @@ class C } - TestParent(code, IsElement("this", kind:=EnvDTE.vsCMElement.vsCMElementProperty)) - End Sub + Await TestParent(code, IsElement("this", kind:=EnvDTE.vsCMElement.vsCMElementProperty)) + End Function #End Region #Region "Type tests" - Public Sub Type1() + Public Async Function TestType1() As Task Dim code = class C @@ -289,21 +290,21 @@ class C } - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "int", .AsFullName = "System.Int32", .CodeTypeFullName = "System.Int32", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefInt }) - End Sub + End Function #End Region #Region "Set ParameterKind tests" - Public Sub SetParameterKind_In() + Public Async Function TestSetParameterKind_In() As Task Dim code = class C @@ -320,11 +321,11 @@ class C } - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindIn) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindIn) + End Function - Public Sub SetParameterKind_None() + Public Async Function TestSetParameterKind_None() As Task Dim code = class C @@ -341,11 +342,11 @@ class C } - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindNone) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindNone) + End Function - Public Sub SetParameterKind_Out() + Public Async Function TestSetParameterKind_Out() As Task Dim code = class C @@ -362,11 +363,11 @@ class C } - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindOut) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindOut) + End Function - Public Sub SetParameterKind_Ref() + Public Async Function TestSetParameterKind_Ref() As Task Dim code = class C @@ -382,11 +383,11 @@ class C void M(ref string s) { } } - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindRef) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindRef) + End Function - Public Sub SetParameterKind_Params() + Public Async Function TestSetParameterKind_Params() As Task Dim code = class C @@ -402,11 +403,11 @@ class C void M(params string[] s) { } } - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindParamArray) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindParamArray) + End Function - Public Sub SetParameterKind_ParamsInvalid() + Public Async Function TestSetParameterKind_ParamsInvalid() As Task Dim code = class C @@ -422,11 +423,11 @@ class C void M(string s) { } } - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindParamArray, ThrowsArgumentException(Of EnvDTE80.vsCMParameterKind)()) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindParamArray, ThrowsArgumentException(Of EnvDTE80.vsCMParameterKind)()) + End Function - Public Sub SetParameterKind_Optional() + Public Async Function TestSetParameterKind_Optional() As Task Dim code = class C @@ -443,13 +444,13 @@ class C } - TestSetParameterKind(code, + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindRef Or EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional) - End Sub + End Function - Public Sub SetParameterKind_Same() + Public Async Function TestSetParameterKind_Same() As Task Dim code = class C @@ -465,15 +466,15 @@ class C void M(out string s) { } } - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindOut) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindOut) + End Function #End Region #Region "Set DefaultValue tests" - Public Sub SetDefaultValue() + Public Async Function TestSetDefaultValue1() As Task Dim code = class C @@ -489,11 +490,11 @@ class C void M(string s = "Foo") { } } - TestSetDefaultValue(code, expected, """Foo""") - End Sub + Await TestSetDefaultValue(code, expected, """Foo""") + End Function - Public Sub SetDefaultValue_ReplaceExisting() + Public Async Function TestSetDefaultValue_ReplaceExisting() As Task Dim code = class C @@ -509,11 +510,11 @@ class C void M(string s = "Foo") { } } - TestSetDefaultValue(code, expected, """Foo""") - End Sub + Await TestSetDefaultValue(code, expected, """Foo""") + End Function - Public Sub SetDefaultValue_None() + Public Async Function TestSetDefaultValue_None() As Task Dim code = class C @@ -529,15 +530,15 @@ class C void M(string s) { } } - TestSetDefaultValue(code, expected, "") - End Sub + Await TestSetDefaultValue(code, expected, "") + End Function #End Region #Region "Set Type tests" - Public Sub SetType1() + Public Async Function TestSetType1() As Task Dim code = class C @@ -554,11 +555,11 @@ class C } - TestSetTypeProp(code, expected, "byte?[,]") - End Sub + Await TestSetTypeProp(code, expected, "byte?[,]") + End Function - Public Sub SetType2() + Public Async Function TestSetType2() As Task Dim code = delegate void Foo(int $$i) { } @@ -569,13 +570,13 @@ delegate void Foo(int $$i) { } delegate void Foo(byte?[,] i) { } - TestSetTypeProp(code, expected, "byte?[,]") - End Sub + Await TestSetTypeProp(code, expected, "byte?[,]") + End Function #End Region - Public Sub TypeDescriptor_GetProperties() + Public Async Function TestTypeDescriptor_GetProperties() As Task Dim code = class C @@ -589,8 +590,8 @@ class C "InfoLocation", "Children", "Language", "StartPoint", "EndPoint", "ExtenderNames", "ExtenderCATID", "Parent", "Type", "Attributes", "DocComment", "ParameterKind", "DefaultValue"} - TestPropertyDescriptors(code, expectedPropertyNames) - End Sub + Await TestPropertyDescriptors(code, expectedPropertyNames) + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodePropertyTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodePropertyTests.vb index 6c532267867599afb3c598ec47f17c5f9aff60d3..454aeae0aabf11d84b11cba3208a99c89bd3ec40 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodePropertyTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodePropertyTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.VisualStudio.LanguageServices.CSharp.CodeModel.Extenders Imports Microsoft.VisualStudio.LanguageServices.CSharp.CodeModel.Interop @@ -12,7 +13,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "GetStartPoint() tests" - Public Sub GetStartPoint() + Public Async Function TestGetStartPoint1() As Task Dim code = class C @@ -30,7 +31,7 @@ class C } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -51,10 +52,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=5, absoluteOffset:=15, lineLength:=16))) - End Sub + End Function - Public Sub GetStartPoint_Attribute() + Public Async Function TestGetStartPoint_Attribute() As Task Dim code = class C @@ -73,7 +74,7 @@ class C } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -94,10 +95,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=5, absoluteOffset:=15, lineLength:=31))) - End Sub + End Function - Public Sub GetStartPoint_AutoProperty() + Public Async Function TestGetStartPoint_AutoProperty() As Task Dim code = class C @@ -106,7 +107,7 @@ class C } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -127,10 +128,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=5, absoluteOffset:=15, lineLength:=30))) - End Sub + End Function - Public Sub GetStartPoint_AutoProperty_Attribute() + Public Async Function TestGetStartPoint_AutoProperty_Attribute() As Task Dim code = class C @@ -140,7 +141,7 @@ class C } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -161,10 +162,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=5, absoluteOffset:=15, lineLength:=31))) - End Sub + End Function - Public Sub GetStartPoint_Indexer() + Public Async Function TestGetStartPoint_Indexer() As Task Dim code = class C @@ -182,7 +183,7 @@ class C } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -203,10 +204,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=5, absoluteOffset:=15, lineLength:=30))) - End Sub + End Function - Public Sub GetStartPoint_Indexer_Attribute() + Public Async Function TestGetStartPoint_Indexer_Attribute() As Task Dim code = class C @@ -225,7 +226,7 @@ class C } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -246,11 +247,11 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=5, absoluteOffset:=15, lineLength:=31))) - End Sub + End Function - Public Sub GetStartPoint_ExplicitlyImplementedIndexer() + Public Async Function TestGetStartPoint_ExplicitlyImplementedIndexer() As Task Dim code = interface I1 @@ -275,14 +276,14 @@ class C1 : I1 } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=9, lineOffset:=5, absoluteOffset:=76, lineLength:=22))) - End Sub + End Function - Public Sub GetStartPoint_ExplicitlyImplementedProperty() + Public Async Function TestGetStartPoint_ExplicitlyImplementedProperty() As Task Dim code = interface I1 @@ -306,17 +307,17 @@ class C1 : I1 } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=8, lineOffset:=5, absoluteOffset:=67, lineLength:=16))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint() + Public Async Function TestGetEndPoint1() As Task Dim code = class C @@ -334,7 +335,7 @@ class C } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -355,10 +356,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=12, lineOffset:=6, absoluteOffset:=136, lineLength:=5))) - End Sub + End Function - Public Sub GetEndPoint_Attribute() + Public Async Function TestGetEndPoint_Attribute() As Task Dim code = class C @@ -377,7 +378,7 @@ class C } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -398,10 +399,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=13, lineOffset:=6, absoluteOffset:=168, lineLength:=5))) - End Sub + End Function - Public Sub GetEndPoint_AutoProperty() + Public Async Function TestGetEndPoint_AutoProperty() As Task Dim code = class C @@ -410,7 +411,7 @@ class C } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -431,10 +432,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=31, absoluteOffset:=41, lineLength:=30))) - End Sub + End Function - Public Sub GetEndPoint_AutoProperty_Attribute() + Public Async Function TestGetEndPoint_AutoProperty_Attribute() As Task Dim code = class C @@ -444,7 +445,7 @@ class C } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -465,10 +466,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=4, lineOffset:=31, absoluteOffset:=73, lineLength:=30))) - End Sub + End Function - Public Sub GetEndPoint_Indexer() + Public Async Function TestGetEndPoint_Indexer() As Task Dim code = class C @@ -486,7 +487,7 @@ class C } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -507,10 +508,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=12, lineOffset:=6, absoluteOffset:=150, lineLength:=5))) - End Sub + End Function - Public Sub GetEndPoint_Indexer_Attribute() + Public Async Function TestGetEndPoint_Indexer_Attribute() As Task Dim code = class C @@ -529,7 +530,7 @@ class C } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -550,11 +551,11 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=13, lineOffset:=6, absoluteOffset:=182, lineLength:=5))) - End Sub + End Function - Public Sub GetEndPoint_ExplicitlyImplementedProperty() + Public Async Function TestGetEndPoint_ExplicitlyImplementedProperty() As Task Dim code = interface I1 @@ -578,14 +579,14 @@ class C1 : I1 } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=18, lineOffset:=6, absoluteOffset:=178, lineLength:=5))) - End Sub + End Function - Public Sub GetEndPoint_ExplicitlyImplementedIndexer() + Public Async Function TestGetEndPoint_ExplicitlyImplementedIndexer() As Task Dim code = interface I1 @@ -610,17 +611,17 @@ class C1 : I1 } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=19, lineOffset:=6, absoluteOffset:=193, lineLength:=5))) - End Sub + End Function #End Region #Region "FullName tests" - Public Sub FullName1() + Public Async Function TestFullName1() As Task Dim code = class C @@ -638,11 +639,11 @@ class C } - TestFullName(code, "C.P") - End Sub + Await TestFullName(code, "C.P") + End Function - Public Sub FullName2() + Public Async Function TestFullName2() As Task Dim code = class C @@ -651,11 +652,11 @@ class C } - TestFullName(code, "C.P") - End Sub + Await TestFullName(code, "C.P") + End Function - Public Sub FullName3() + Public Async Function TestFullName3() As Task Dim code = class C @@ -664,12 +665,12 @@ class C } - TestFullName(code, "C.this") - End Sub + Await TestFullName(code, "C.this") + End Function - Public Sub FullName_ExplicitlyImplementedProperty() + Public Async Function TestFullName_ExplicitlyImplementedProperty() As Task Dim code = interface I1 @@ -693,12 +694,12 @@ class C1 : I1 } - TestFullName(code, "C1.I1.Prop1") - End Sub + Await TestFullName(code, "C1.I1.Prop1") + End Function - Public Sub FullName_ExplicitlyImplementedIndexer() + Public Async Function TestFullName_ExplicitlyImplementedIndexer() As Task Dim code = interface I1 @@ -723,15 +724,15 @@ class C1 : I1 } - TestFullName(code, "C1.I1.this") - End Sub + Await TestFullName(code, "C1.I1.this") + End Function #End Region #Region "IsDefault tests" - Public Sub IsDefault1() + Public Async Function TestIsDefault1() As Task Dim code = class C @@ -749,11 +750,11 @@ class C } - TestIsDefault(code, True) - End Sub + Await TestIsDefault(code, True) + End Function - Public Sub IsDefault2() + Public Async Function TestIsDefault2() As Task Dim code = public int $$P @@ -767,11 +768,11 @@ class C } - TestIsDefault(code, False) - End Sub + Await TestIsDefault(code, False) + End Function - Public Sub IsDefault3() + Public Async Function TestIsDefault3() As Task Dim code = class C @@ -780,15 +781,15 @@ class C } - TestIsDefault(code, False) - End Sub + Await TestIsDefault(code, False) + End Function #End Region #Region "Name tests" - Public Sub Name1() + Public Async Function TestName1() As Task Dim code = class C @@ -806,11 +807,11 @@ class C } - TestName(code, "P") - End Sub + Await TestName(code, "P") + End Function - Public Sub Name2() + Public Async Function TestName2() As Task Dim code = class C @@ -819,11 +820,11 @@ class C } - TestName(code, "P") - End Sub + Await TestName(code, "P") + End Function - Public Sub Name3() + Public Async Function TestName3() As Task Dim code = class C @@ -832,12 +833,12 @@ class C } - TestName(code, "this") - End Sub + Await TestName(code, "this") + End Function - Public Sub Name_ExplicitlyImplementedProperty() + Public Async Function TestName_ExplicitlyImplementedProperty() As Task Dim code = interface I1 @@ -861,12 +862,12 @@ class C1 : I1 } - TestName(code, "I1.Prop1") - End Sub + Await TestName(code, "I1.Prop1") + End Function - Public Sub Name_ExplicitlyImplementedIndexer() + Public Async Function TestName_ExplicitlyImplementedIndexer() As Task Dim code = interface I1 @@ -891,15 +892,15 @@ class C1 : I1 } - TestName(code, "I1.this") - End Sub + Await TestName(code, "I1.this") + End Function #End Region #Region "Prototype tests" - Public Sub Prototype_ClassName1() + Public Async Function TestPrototype_ClassName1() As Task Dim code = namespace N @@ -911,11 +912,11 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.this[int index]") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.this[int index]") + End Function - Public Sub Prototype_ClassName2() + Public Async Function TestPrototype_ClassName2() As Task Dim code = namespace N @@ -927,11 +928,11 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.P") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.P") + End Function - Public Sub Prototype_FullName1() + Public Async Function TestPrototype_FullName1() As Task Dim code = namespace N @@ -943,11 +944,11 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "N.C.this[int index]") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "N.C.this[int index]") + End Function - Public Sub Prototype_FullName2() + Public Async Function TestPrototype_FullName2() As Task Dim code = namespace N @@ -959,15 +960,15 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "N.C.P") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "N.C.P") + End Function #End Region #Region "Type tests" - Public Sub Type1() + Public Async Function TestType1() As Task Dim code = class C @@ -985,21 +986,21 @@ class C } - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsFullName = "System.Int32", .AsString = "int", .CodeTypeFullName = "System.Int32", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefInt }) - End Sub + End Function #End Region #Region "OverrideKind tests" - Public Sub OverrideKind1() + Public Async Function TestOverrideKind1() As Task Dim code = class C @@ -1017,11 +1018,11 @@ class C } - TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNone) - End Sub + Await TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNone) + End Function - Public Sub OverrideKind2() + Public Async Function TestOverrideKind2() As Task Dim code = abstract class C @@ -1034,15 +1035,15 @@ abstract class C } - TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) - End Sub + Await TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) + End Function #End Region #Region "ReadWrite tests" - Public Sub ReadWrite1() + Public Async Function TestReadWrite1() As Task Dim code = class C @@ -1060,11 +1061,11 @@ class C } - TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindReadWrite) - End Sub + Await TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindReadWrite) + End Function - Public Sub ReadWrite2() + Public Async Function TestReadWrite2() As Task Dim code = class C @@ -1079,11 +1080,11 @@ class C } - TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindReadOnly) - End Sub + Await TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindReadOnly) + End Function - Public Sub ReadWrite3() + Public Async Function TestReadWrite3() As Task Dim code = class C @@ -1097,11 +1098,11 @@ class C } - TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindWriteOnly) - End Sub + Await TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindWriteOnly) + End Function - Public Sub ReadWrite4() + Public Async Function TestReadWrite4() As Task Dim code = class C @@ -1110,15 +1111,15 @@ class C } - TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindReadWrite) - End Sub + Await TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindReadWrite) + End Function #End Region #Region "Set OverrideKind tests" - Public Sub SetOverrideKind1() + Public Async Function TestSetOverrideKind1() As Task Dim code = abstract class C @@ -1147,11 +1148,11 @@ abstract class C } - TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) - End Sub + Await TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) + End Function - Public Sub SetOverrideKind2() + Public Async Function TestSetOverrideKind2() As Task Dim code = abstract class C @@ -1179,15 +1180,15 @@ abstract class C } - TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNone) - End Sub + Await TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNone) + End Function #End Region #Region "Set IsDefault tests" - Public Sub SetIsDefault1() + Public Async Function TestSetIsDefault1() As Task Dim code = abstract class C @@ -1222,15 +1223,15 @@ abstract class C } - TestSetIsDefault(code, expected, True, ThrowsInvalidOperationException(Of Boolean)) - End Sub + Await TestSetIsDefault(code, expected, True, ThrowsInvalidOperationException(Of Boolean)) + End Function #End Region #Region "Set Type tests" - Public Sub SetType1() + Public Async Function TestSetType1() As Task Dim code = class C @@ -1247,11 +1248,11 @@ class C } - TestSetTypeProp(code, expected, "string") - End Sub + Await TestSetTypeProp(code, expected, "string") + End Function - Public Sub SetType2() + Public Async Function TestSetType2() As Task Dim code = class C @@ -1268,15 +1269,15 @@ class C } - TestSetTypeProp(code, expected, "System.String") - End Sub + Await TestSetTypeProp(code, expected, "System.String") + End Function #End Region #Region "AutoImplementedPropertyExtender" - Public Sub AutoImplementedPropertyExtender_IsAutoImplemented1() + Public Async Function TestAutoImplementedPropertyExtender_IsAutoImplemented1() As Task Dim code = public class C @@ -1285,11 +1286,11 @@ public class C } - TestAutoImplementedPropertyExtender_IsAutoImplemented(code, True) - End Sub + Await TestAutoImplementedPropertyExtender_IsAutoImplemented(code, True) + End Function - Public Sub AutoImplementedPropertyExtender_IsAutoImplemented2() + Public Async Function TestAutoImplementedPropertyExtender_IsAutoImplemented2() As Task Dim code = public class C @@ -1302,11 +1303,11 @@ public class C } - TestAutoImplementedPropertyExtender_IsAutoImplemented(code, False) - End Sub + Await TestAutoImplementedPropertyExtender_IsAutoImplemented(code, False) + End Function - Public Sub AutoImplementedPropertyExtender_IsAutoImplemented3() + Public Async Function TestAutoImplementedPropertyExtender_IsAutoImplemented3() As Task Dim code = public interface I @@ -1315,8 +1316,8 @@ public interface I } - TestAutoImplementedPropertyExtender_IsAutoImplemented(code, False) - End Sub + Await TestAutoImplementedPropertyExtender_IsAutoImplemented(code, False) + End Function #End Region @@ -1324,7 +1325,7 @@ public interface I - Public Sub TestParameterNameWithEscapeCharacters() + Public Async Function TestParameterNameWithEscapeCharacters() As Task Dim code = class Program @@ -1337,15 +1338,15 @@ class Program } - TestAllParameterNames(code, "@int") - End Sub + Await TestAllParameterNames(code, "@int") + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = using System; @@ -1374,11 +1375,11 @@ class C } } - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = using System; @@ -1409,12 +1410,12 @@ class C } } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment() + Public Async Function TestAddAttribute_BelowDocComment() As Task Dim code = using System; @@ -1445,13 +1446,13 @@ class C } } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) + End Function #End Region - Public Sub TypeDescriptor_GetProperties() + Public Async Function TestTypeDescriptor_GetProperties() As Task Dim code = class C @@ -1467,8 +1468,8 @@ class C "DocComment", "Comment", "Parameters", "IsGeneric", "OverrideKind", "IsShared", "IsDefault", "Parent2", "ReadWrite"} - TestPropertyDescriptors(code, expectedPropertyNames) - End Sub + Await TestPropertyDescriptors(code, expectedPropertyNames) + End Function Private Function GetAutoImplementedPropertyExtender(codeElement As EnvDTE80.CodeProperty2) As ICSAutoImplementedPropertyExtender Return CType(codeElement.Extender(ExtenderNames.AutoImplementedProperty), ICSAutoImplementedPropertyExtender) diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeStructTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeStructTests.vb index 6f21647ffff08e07d0987a9315e2d0877843f0f0..629774424be2d9d7157695e128a1ab55c3afc601 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeStructTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeStructTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,17 +11,17 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "Attributes tests" - Public Sub Attributes1() + Public Async Function TestAttributes1() As Task Dim code = struct $$C { } - TestAttributes(code, NoElements) - End Sub + Await TestAttributes(code, NoElements) + End Function - Public Sub Attributes2() + Public Async Function TestAttributes2() As Task Dim code = using System; @@ -29,11 +30,11 @@ using System; struct $$C { } - TestAttributes(code, IsElement("Serializable")) - End Sub + Await TestAttributes(code, IsElement("Serializable")) + End Function - Public Sub Attributes3() + Public Async Function TestAttributes3() As Task Dim code = using System; @@ -42,11 +43,11 @@ struct $$C { } struct $$C { } - TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) - End Sub + Await TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) + End Function - Public Sub Attributes4() + Public Async Function TestAttributes4() As Task Dim code = using System; @@ -54,31 +55,31 @@ struct $$C { } struct $$C { } - TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) - End Sub + Await TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) + End Function #End Region #Region "Bases tests" - Public Sub Base1() + Public Async Function TestBase1() As Task Dim code = struct $$S { } - TestBases(code, IsElement("ValueType", kind:=EnvDTE.vsCMElement.vsCMElementClass)) - End Sub + Await TestBases(code, IsElement("ValueType", kind:=EnvDTE.vsCMElement.vsCMElementClass)) + End Function - Public Sub Base2() + Public Async Function TestBase2() As Task Dim code = struct $$S : System.IDisposable { } - TestBases(code, IsElement("ValueType", kind:=EnvDTE.vsCMElement.vsCMElementClass)) - End Sub + Await TestBases(code, IsElement("ValueType", kind:=EnvDTE.vsCMElement.vsCMElementClass)) + End Function #End Region @@ -86,17 +87,17 @@ struct $$S : System.IDisposable { } #Region "DataTypeKind tests" - Public Sub DataTypeKind1() + Public Async Function TestDataTypeKind1() As Task Dim code = struct $$S { } - TestDataTypeKind(code, EnvDTE80.vsCMDataTypeKind.vsCMDataTypeKindMain) - End Sub + Await TestDataTypeKind(code, EnvDTE80.vsCMDataTypeKind.vsCMDataTypeKindMain) + End Function - Public Sub DataTypeKind2() + Public Async Function TestDataTypeKind2() As Task Dim code = partial struct $$S { } @@ -104,25 +105,25 @@ partial struct $$S { } partial struct S { } - TestDataTypeKind(code, EnvDTE80.vsCMDataTypeKind.vsCMDataTypeKindPartial) - End Sub + Await TestDataTypeKind(code, EnvDTE80.vsCMDataTypeKind.vsCMDataTypeKindPartial) + End Function #End Region #Region "FullName tests" - Public Sub FullName1() + Public Async Function TestFullName1() As Task Dim code = struct $$S { } - TestFullName(code, "S") - End Sub + Await TestFullName(code, "S") + End Function - Public Sub FullName2() + Public Async Function TestFullName2() As Task Dim code = namespace N @@ -131,11 +132,11 @@ namespace N } - TestFullName(code, "N.S") - End Sub + Await TestFullName(code, "N.S") + End Function - Public Sub FullName3() + Public Async Function TestFullName3() As Task Dim code = namespace N @@ -147,39 +148,39 @@ namespace N } - TestFullName(code, "N.C.S") - End Sub + Await TestFullName(code, "N.C.S") + End Function #End Region #Region "ImplementedInterfaces tests" - Public Sub ImplementedInterfaces1() + Public Async Function TestImplementedInterfaces1() As Task Dim code = struct $$S : System.IDisposable { } - TestImplementedInterfaces(code, IsElement("IDisposable", kind:=EnvDTE.vsCMElement.vsCMElementInterface)) - End Sub + Await TestImplementedInterfaces(code, IsElement("IDisposable", kind:=EnvDTE.vsCMElement.vsCMElementInterface)) + End Function #End Region #Region "Name tests" - Public Sub Name1() + Public Async Function TestName1() As Task Dim code = struct $$S { } - TestName(code, "S") - End Sub + Await TestName(code, "S") + End Function - Public Sub Name2() + Public Async Function TestName2() As Task Dim code = namespace N @@ -188,11 +189,11 @@ namespace N } - TestName(code, "S") - End Sub + Await TestName(code, "S") + End Function - Public Sub Name3() + Public Async Function TestName3() As Task Dim code = namespace N @@ -204,25 +205,25 @@ namespace N } - TestName(code, "S") - End Sub + Await TestName(code, "S") + End Function #End Region #Region "Parent tests" - Public Sub Parent1() + Public Async Function TestParent1() As Task Dim code = struct $$S { } - TestParent(code, IsFileCodeModel) - End Sub + Await TestParent(code, IsFileCodeModel) + End Function - Public Sub Parent2() + Public Async Function TestParent2() As Task Dim code = namespace N @@ -231,11 +232,11 @@ namespace N } - TestParent(code, IsElement("N", kind:=EnvDTE.vsCMElement.vsCMElementNamespace)) - End Sub + Await TestParent(code, IsElement("N", kind:=EnvDTE.vsCMElement.vsCMElementNamespace)) + End Function - Public Sub Parent3() + Public Async Function TestParent3() As Task Dim code = namespace N @@ -247,14 +248,14 @@ namespace N } - TestParent(code, IsElement("C", kind:=EnvDTE.vsCMElement.vsCMElementClass)) - End Sub + Await TestParent(code, IsElement("C", kind:=EnvDTE.vsCMElement.vsCMElementClass)) + End Function #End Region #Region "Parts tests" - Public Sub Parts1() + Public Async Function TestParts1() As Task Dim code = struct $$S @@ -262,11 +263,11 @@ struct $$S } - TestParts(code, 1) - End Sub + Await TestParts(code, 1) + End Function - Public Sub Parts2() + Public Async Function TestParts2() As Task Dim code = partial struct $$S @@ -274,11 +275,11 @@ partial struct $$S } - TestParts(code, 1) - End Sub + Await TestParts(code, 1) + End Function - Public Sub Parts3() + Public Async Function TestParts3() As Task Dim code = partial struct $$S @@ -290,13 +291,13 @@ partial struct S } - TestParts(code, 2) - End Sub + Await TestParts(code, 2) + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = using System; @@ -311,11 +312,11 @@ using System; [Serializable()] struct S { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = using System; @@ -332,12 +333,12 @@ using System; [CLSCompliant(true)] struct S { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment() + Public Async Function TestAddAttribute_BelowDocComment() As Task Dim code = using System; @@ -354,15 +355,15 @@ using System; [CLSCompliant(true)] struct S { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) + End Function #End Region #Region "AddFunction tests" - Public Sub AddFunction1() + Public Async Function TestAddFunction1() As Task Dim code = struct $$S { } @@ -379,25 +380,25 @@ struct S } - TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "void"}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Type = "void"}) + End Function #End Region #Region "AddImplementedInterface tests" - Public Sub AddImplementedInterface1() + Public Async Function TestAddImplementedInterface1() As Task Dim code = struct $$S { } - TestAddImplementedInterfaceThrows(Of ArgumentException)(code, "I", Nothing) - End Sub + Await TestAddImplementedInterfaceThrows(Of ArgumentException)(code, "I", Nothing) + End Function - Public Sub AddImplementedInterface2() + Public Async Function TestAddImplementedInterface2() As Task Dim code = struct $$S { } @@ -410,11 +411,11 @@ struct S : I { } interface I { } - TestAddImplementedInterface(code, "I", -1, expected) - End Sub + Await TestAddImplementedInterface(code, "I", -1, expected) + End Function - Public Sub AddImplementedInterface3() + Public Async Function TestAddImplementedInterface3() As Task Dim code = struct $$S : I { } @@ -429,11 +430,11 @@ interface I { } interface J { } - TestAddImplementedInterface(code, "J", -1, expected) - End Sub + Await TestAddImplementedInterface(code, "J", -1, expected) + End Function - Public Sub AddImplementedInterface4() + Public Async Function TestAddImplementedInterface4() As Task Dim code = struct $$S : I { } @@ -448,11 +449,11 @@ interface I { } interface J { } - TestAddImplementedInterface(code, "J", 0, expected) - End Sub + Await TestAddImplementedInterface(code, "J", 0, expected) + End Function - Public Sub AddImplementedInterface5() + Public Async Function TestAddImplementedInterface5() As Task Dim code = struct $$S : I, K { } @@ -469,15 +470,15 @@ interface J { } interface K { } - TestAddImplementedInterface(code, "J", 1, expected) - End Sub + Await TestAddImplementedInterface(code, "J", 1, expected) + End Function #End Region #Region "RemoveImplementedInterface tests" - Public Sub RemoveImplementedInterface1() + Public Async Function TestRemoveImplementedInterface1() As Task Dim code = struct $$S : I { } @@ -489,14 +490,14 @@ interface I { } struct S { } interface I { } - TestRemoveImplementedInterface(code, "I", expected) - End Sub + Await TestRemoveImplementedInterface(code, "I", expected) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = struct $$Foo @@ -511,12 +512,12 @@ struct Bar } - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region - Public Sub TypeDescriptor_GetProperties() + Public Async Function TestTypeDescriptor_GetProperties() As Task Dim code = struct $$S @@ -531,8 +532,8 @@ struct $$S "DocComment", "Comment", "DerivedTypes", "ImplementedInterfaces", "IsAbstract", "IsGeneric", "DataTypeKind", "Parts"} - TestPropertyDescriptors(code, expectedPropertyNames) - End Sub + Await TestPropertyDescriptors(code, expectedPropertyNames) + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeVariableTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeVariableTests.vb index 31380b4f14f13e5aa7b10d0c710f5faa89ae3ed9..2e19b28937cf4669162ec9e38c18af1335c4b0df 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeVariableTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/CodeVariableTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,7 +11,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "GetStartPoint() tests" - Public Sub GetStartPoint_Field() + Public Async Function TestGetStartPoint_Field() As Task Dim code = class C @@ -19,7 +20,7 @@ class C } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -40,10 +41,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=5, absoluteOffset:=15, lineLength:=12))) - End Sub + End Function - Public Sub GetStartPoint_EnumMember() + Public Async Function TestGetStartPoint_EnumMember() As Task Dim code = enum E @@ -52,7 +53,7 @@ enum E } - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -73,14 +74,14 @@ enum E ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=5, absoluteOffset:=14, lineLength:=7))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint_Field() + Public Async Function TestGetEndPoint_Field() As Task Dim code = class C @@ -89,7 +90,7 @@ class C } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -110,10 +111,10 @@ class C ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=13, absoluteOffset:=23, lineLength:=12))) - End Sub + End Function - Public Sub GetEndPoint_EnumMember() + Public Async Function TestGetEndPoint_EnumMember() As Task Dim code = enum E @@ -122,7 +123,7 @@ enum E } - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -143,14 +144,14 @@ enum E ThrowsNotImplementedException), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=8, absoluteOffset:=17, lineLength:=7))) - End Sub + End Function #End Region #Region "Access tests" - Public Sub Access1() + Public Async Function TestAccess1() As Task Dim code = class C @@ -159,11 +160,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access2() + Public Async Function TestAccess2() As Task Dim code = class C @@ -172,11 +173,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access3() + Public Async Function TestAccess3() As Task Dim code = class C @@ -185,11 +186,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) + End Function - Public Sub Access4() + Public Async Function TestAccess4() As Task Dim code = class C @@ -198,11 +199,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub Access5() + Public Async Function TestAccess5() As Task Dim code = class C @@ -211,11 +212,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access6() + Public Async Function TestAccess6() As Task Dim code = class C @@ -224,11 +225,11 @@ class C } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access7() + Public Async Function TestAccess7() As Task Dim code = enum E @@ -237,15 +238,15 @@ enum E } - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function #End Region #Region "Attributes tests" - Public Sub Attributes1() + Public Async Function TestAttributes1() As Task Dim code = class C @@ -254,11 +255,11 @@ class C } - TestAttributes(code, NoElements) - End Sub + Await TestAttributes(code, NoElements) + End Function - Public Sub Attributes2() + Public Async Function TestAttributes2() As Task Dim code = using System; @@ -270,11 +271,11 @@ class C } - TestAttributes(code, IsElement("Serializable")) - End Sub + Await TestAttributes(code, IsElement("Serializable")) + End Function - Public Sub Attributes3() + Public Async Function TestAttributes3() As Task Dim code = using System; @@ -286,11 +287,11 @@ class C } - TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) - End Sub + Await TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) + End Function - Public Sub Attributes4() + Public Async Function TestAttributes4() As Task Dim code = using System; @@ -301,14 +302,14 @@ class C } - TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) - End Sub + Await TestAttributes(code, IsElement("Serializable"), IsElement("CLSCompliant")) + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = using System; @@ -330,11 +331,11 @@ class C } - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = using System; @@ -357,12 +358,12 @@ class C int F; } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment() + Public Async Function TestAddAttribute_BelowDocComment() As Task Dim code = using System; @@ -385,15 +386,15 @@ class C int F; } - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) + End Function #End Region #Region "ConstKind tests" - Public Sub ConstKind1() + Public Async Function TestConstKind1() As Task Dim code = enum E @@ -402,11 +403,11 @@ enum E } - TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindConst) - End Sub + Await TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindConst) + End Function - Public Sub ConstKind2() + Public Async Function TestConstKind2() As Task Dim code = class C @@ -415,11 +416,11 @@ class C } - TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindNone) - End Sub + Await TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindNone) + End Function - Public Sub ConstKind3() + Public Async Function TestConstKind3() As Task Dim code = class C @@ -428,11 +429,11 @@ class C } - TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindConst) - End Sub + Await TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindConst) + End Function - Public Sub ConstKind4() + Public Async Function TestConstKind4() As Task Dim code = class C @@ -441,11 +442,11 @@ class C } - TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly) - End Sub + Await TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly) + End Function - Public Sub ConstKind5() + Public Async Function TestConstKind5() As Task Dim code = class C @@ -454,15 +455,15 @@ class C } - TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindConst Or EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly) - End Sub + Await TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindConst Or EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly) + End Function #End Region #Region "FullName tests" - Public Sub FullName1() + Public Async Function TestFullName1() As Task Dim code = enum E @@ -472,11 +473,11 @@ enum E } - TestFullName(code, "E.Foo") - End Sub + Await TestFullName(code, "E.Foo") + End Function - Public Sub FullName2() + Public Async Function TestFullName2() As Task Dim code = enum E @@ -486,15 +487,15 @@ enum E } - TestFullName(code, "E.Bar") - End Sub + Await TestFullName(code, "E.Bar") + End Function #End Region #Region "InitExpression tests" - Public Sub InitExpression1() + Public Async Function TestInitExpression1() As Task Dim code = class C @@ -503,11 +504,11 @@ class C } - TestInitExpression(code, "42") - End Sub + Await TestInitExpression(code, "42") + End Function - Public Sub InitExpression2() + Public Async Function TestInitExpression2() As Task Dim code = class C @@ -516,11 +517,11 @@ class C } - TestInitExpression(code, "19 + 23") - End Sub + Await TestInitExpression(code, "19 + 23") + End Function - Public Sub InitExpression3() + Public Async Function TestInitExpression3() As Task Dim code = enum E @@ -529,15 +530,15 @@ enum E } - TestInitExpression(code, "19 + 23") - End Sub + Await TestInitExpression(code, "19 + 23") + End Function #End Region #Region "IsConstant tests" - Public Sub IsConstant1() + Public Async Function TestIsConstant1() As Task Dim code = enum E @@ -546,11 +547,11 @@ enum E } - TestIsConstant(code, True) - End Sub + Await TestIsConstant(code, True) + End Function - Public Sub IsConstant2() + Public Async Function TestIsConstant2() As Task Dim code = class C @@ -559,11 +560,11 @@ class C } - TestIsConstant(code, True) - End Sub + Await TestIsConstant(code, True) + End Function - Public Sub IsConstant3() + Public Async Function TestIsConstant3() As Task Dim code = class C @@ -572,11 +573,11 @@ class C } - TestIsConstant(code, True) - End Sub + Await TestIsConstant(code, True) + End Function - Public Sub IsConstant4() + Public Async Function TestIsConstant4() As Task Dim code = class C @@ -585,15 +586,15 @@ class C } - TestIsConstant(code, False) - End Sub + Await TestIsConstant(code, False) + End Function #End Region #Region "IsShared tests" - Public Sub IsShared1() + Public Async Function TestIsShared1() As Task Dim code = class C @@ -602,11 +603,11 @@ class C } - TestIsShared(code, False) - End Sub + Await TestIsShared(code, False) + End Function - Public Sub IsShared2() + Public Async Function TestIsShared2() As Task Dim code = class C @@ -615,15 +616,15 @@ class C } - TestIsShared(code, True) - End Sub + Await TestIsShared(code, True) + End Function #End Region #Region "Name tests" - Public Sub Name1() + Public Async Function TestName1() As Task Dim code = enum E @@ -633,11 +634,11 @@ enum E } - TestName(code, "Foo") - End Sub + Await TestName(code, "Foo") + End Function - Public Sub Name2() + Public Async Function TestName2() As Task Dim code = enum E @@ -647,15 +648,15 @@ enum E } - TestName(code, "Bar") - End Sub + Await TestName(code, "Bar") + End Function #End Region #Region "Prototype tests" - Public Sub Prototype_ClassName() + Public Async Function TestPrototype_ClassName() As Task Dim code = namespace N @@ -667,11 +668,11 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.x") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.x") + End Function - Public Sub Prototype_FullName() + Public Async Function TestPrototype_FullName() As Task Dim code = namespace N @@ -683,11 +684,11 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "N.C.x") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "N.C.x") + End Function - Public Sub Prototype_InitExpression1() + Public Async Function TestPrototype_InitExpression1() As Task Dim code = namespace N @@ -699,11 +700,11 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression, "x = 0") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression, "x = 0") + End Function - Public Sub Prototype_InitExpression2() + Public Async Function TestPrototype_InitExpression2() As Task Dim code = namespace N @@ -715,11 +716,11 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression, "A = 42") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression, "A = 42") + End Function - Public Sub Prototype_InitExpressionAndType1() + Public Async Function TestPrototype_InitExpressionAndType1() As Task Dim code = namespace N @@ -731,11 +732,11 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression Or EnvDTE.vsCMPrototype.vsCMPrototypeType, "int x = 0") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression Or EnvDTE.vsCMPrototype.vsCMPrototypeType, "int x = 0") + End Function - Public Sub Prototype_InitExpressionAndType2() + Public Async Function TestPrototype_InitExpressionAndType2() As Task Dim code = namespace N @@ -747,11 +748,11 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression Or EnvDTE.vsCMPrototype.vsCMPrototypeType, "N.E A = 42") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression Or EnvDTE.vsCMPrototype.vsCMPrototypeType, "N.E A = 42") + End Function - Public Sub Prototype_ClassNameInitExpressionAndType() + Public Async Function TestPrototype_ClassNameInitExpressionAndType() As Task Dim code = namespace N @@ -763,15 +764,15 @@ namespace N } - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression Or EnvDTE.vsCMPrototype.vsCMPrototypeType Or EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "N.E E.A = 42") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression Or EnvDTE.vsCMPrototype.vsCMPrototypeType Or EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "N.E E.A = 42") + End Function #End Region #Region "Type tests" - Public Sub Type1() + Public Async Function TestType1() As Task Dim code = class C @@ -780,17 +781,17 @@ class C } - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "int", .AsFullName = "System.Int32", .CodeTypeFullName = "System.Int32", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefInt }) - End Sub + End Function - Public Sub Type2() + Public Async Function TestType2() As Task Dim code = class C @@ -799,18 +800,18 @@ class C } - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "int", .AsFullName = "System.Int32", .CodeTypeFullName = "System.Int32", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefInt }) - End Sub + End Function - Public Sub ArrayTypeName() + Public Async Function TestArrayTypeName() As Task Dim code = class C @@ -819,20 +820,20 @@ class C } - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "int[]", .AsFullName = "System.Int32[]", .CodeTypeFullName = "System.Int32[]", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefArray }) - End Sub + End Function #End Region #Region "Set Access tests" - Public Sub SetEnumAccess1() + Public Async Function TestSetEnumAccess1() As Task Dim code = enum E @@ -849,11 +850,11 @@ enum E } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetEnumAccess2() + Public Async Function TestSetEnumAccess2() As Task Dim code = enum E @@ -870,11 +871,11 @@ enum E } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetEnumAccess3() + Public Async Function TestSetEnumAccess3() As Task Dim code = enum E @@ -891,11 +892,11 @@ enum E } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPrivate, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPrivate, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) + End Function - Public Sub SetAccess1() + Public Async Function TestSetAccess1() As Task Dim code = class C @@ -912,11 +913,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetAccess2() + Public Async Function TestSetAccess2() As Task Dim code = class C @@ -933,11 +934,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetAccess3() + Public Async Function TestSetAccess3() As Task Dim code = class C @@ -954,11 +955,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetAccess4() + Public Async Function TestSetAccess4() As Task Dim code = class C @@ -975,11 +976,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetAccess5() + Public Async Function TestSetAccess5() As Task Dim code = class C @@ -996,11 +997,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub SetAccess6() + Public Async Function TestSetAccess6() As Task Dim code = class C @@ -1029,11 +1030,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetAccess7() + Public Async Function TestSetAccess7() As Task Dim code = class C @@ -1062,11 +1063,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub SetAccess8() + Public Async Function TestSetAccess8() As Task Dim code = class C @@ -1095,11 +1096,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetAccess9() + Public Async Function TestSetAccess9() As Task Dim code = class C @@ -1124,11 +1125,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetAccess10() + Public Async Function TestSetAccess10() As Task Dim code = class C @@ -1153,11 +1154,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetAccess11() + Public Async Function TestSetAccess11() As Task Dim code = class C @@ -1182,11 +1183,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub SetAccess12() + Public Async Function TestSetAccess12() As Task Dim code = class C @@ -1213,11 +1214,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub SetAccess13() + Public Async Function TestSetAccess13() As Task Dim code = class C @@ -1244,11 +1245,11 @@ class C } - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub SetAccess14() + Public Async Function TestSetAccess14() As Task Dim code = - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function #End Region #Region "Set ConstKind tests" - Public Sub SetConstKind1() + Public Async Function TestSetConstKind1() As Task Dim code = enum E @@ -1304,11 +1305,11 @@ enum E } - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindConst) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindConst) + End Function - Public Sub SetConstKind2() + Public Async Function TestSetConstKind2() As Task Dim code = enum E @@ -1325,11 +1326,11 @@ enum E } - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly) + End Function - Public Sub SetConstKind3() + Public Async Function TestSetConstKind3() As Task Dim code = enum E @@ -1346,11 +1347,11 @@ enum E } - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone, ThrowsArgumentException(Of EnvDTE80.vsCMConstKind)) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone, ThrowsArgumentException(Of EnvDTE80.vsCMConstKind)) + End Function - Public Sub SetConstKind4() + Public Async Function TestSetConstKind4() As Task Dim code = class C @@ -1367,11 +1368,11 @@ class C } - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) + End Function - Public Sub SetConstKind5() + Public Async Function TestSetConstKind5() As Task Dim code = class C @@ -1388,11 +1389,11 @@ class C } - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindConst) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindConst) + End Function - Public Sub SetConstKind6() + Public Async Function TestSetConstKind6() As Task Dim code = class C @@ -1409,11 +1410,11 @@ class C } - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) + End Function - Public Sub SetConstKind7() + Public Async Function TestSetConstKind7() As Task Dim code = class C @@ -1430,11 +1431,11 @@ class C } - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly) + End Function - Public Sub SetConstKind8() + Public Async Function TestSetConstKind8() As Task Dim code = class C @@ -1451,11 +1452,11 @@ class C } - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) + End Function - Public Sub SetConstKindWhenVolatileIsPresent1() + Public Async Function TestSetConstKindWhenVolatileIsPresent1() As Task Dim code = class C @@ -1472,11 +1473,11 @@ class C } - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindConst) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindConst) + End Function - Public Sub SetConstKindWhenVolatileIsPresent2() + Public Async Function TestSetConstKindWhenVolatileIsPresent2() As Task Dim code = class C @@ -1493,11 +1494,11 @@ class C } - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly) + End Function - Public Sub SetConstKindWhenVolatileIsPresent3() + Public Async Function TestSetConstKindWhenVolatileIsPresent3() As Task Dim code = class C @@ -1514,11 +1515,11 @@ class C } - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindConst) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindConst) + End Function - Public Sub SetConstKindWhenVolatileIsPresent4() + Public Async Function TestSetConstKindWhenVolatileIsPresent4() As Task Dim code = class C @@ -1535,15 +1536,15 @@ class C } - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) + End Function #End Region #Region "Set InitExpression tests" - Public Sub SetInitExpression1() + Public Async Function TestSetInitExpression1() As Task Dim code = class C @@ -1560,11 +1561,11 @@ class C } - TestSetInitExpression(code, expected, "42") - End Sub + Await TestSetInitExpression(code, expected, "42") + End Function - Public Sub SetInitExpression2() + Public Async Function TestSetInitExpression2() As Task Dim code = class C @@ -1581,11 +1582,11 @@ class C } - TestSetInitExpression(code, expected, Nothing) - End Sub + Await TestSetInitExpression(code, expected, Nothing) + End Function - Public Sub SetInitExpression3() + Public Async Function TestSetInitExpression3() As Task Dim code = class C @@ -1602,11 +1603,11 @@ class C } - TestSetInitExpression(code, expected, "42") - End Sub + Await TestSetInitExpression(code, expected, "42") + End Function - Public Sub SetInitExpression4() + Public Async Function TestSetInitExpression4() As Task Dim code = class C @@ -1623,11 +1624,11 @@ class C } - TestSetInitExpression(code, expected, "42") - End Sub + Await TestSetInitExpression(code, expected, "42") + End Function - Public Sub SetInitExpression5() + Public Async Function TestSetInitExpression5() As Task Dim code = class C @@ -1644,11 +1645,11 @@ class C } - TestSetInitExpression(code, expected, "42") - End Sub + Await TestSetInitExpression(code, expected, "42") + End Function - Public Sub SetInitExpression6() + Public Async Function TestSetInitExpression6() As Task Dim code = enum E @@ -1665,11 +1666,11 @@ enum E } - TestSetInitExpression(code, expected, "42") - End Sub + Await TestSetInitExpression(code, expected, "42") + End Function - Public Sub SetInitExpression7() + Public Async Function TestSetInitExpression7() As Task Dim code = enum E @@ -1686,15 +1687,15 @@ enum E } - TestSetInitExpression(code, expected, Nothing) - End Sub + Await TestSetInitExpression(code, expected, Nothing) + End Function #End Region #Region "Set IsConstant tests" - Public Sub SetIsConstant1() + Public Async Function TestSetIsConstant1() As Task Dim code = enum E @@ -1711,11 +1712,11 @@ enum E } - TestSetIsConstant(code, expected, True) - End Sub + Await TestSetIsConstant(code, expected, True) + End Function - Public Sub SetIsConstant2() + Public Async Function TestSetIsConstant2() As Task Dim code = enum E @@ -1732,11 +1733,11 @@ enum E } - TestSetIsConstant(code, expected, False, ThrowsCOMException(Of Boolean)(E_FAIL)) - End Sub + Await TestSetIsConstant(code, expected, False, ThrowsCOMException(Of Boolean)(E_FAIL)) + End Function - Public Sub SetIsConstant3() + Public Async Function TestSetIsConstant3() As Task Dim code = class C @@ -1753,11 +1754,11 @@ class C } - TestSetIsConstant(code, expected, True) - End Sub + Await TestSetIsConstant(code, expected, True) + End Function - Public Sub SetIsConstant4() + Public Async Function TestSetIsConstant4() As Task Dim code = class C @@ -1774,11 +1775,11 @@ class C } - TestSetIsConstant(code, expected, False) - End Sub + Await TestSetIsConstant(code, expected, False) + End Function - Public Sub SetIsConstant5() + Public Async Function TestSetIsConstant5() As Task Dim code = class C @@ -1795,11 +1796,11 @@ class C } - TestSetIsConstant(code, expected, False) - End Sub + Await TestSetIsConstant(code, expected, False) + End Function - Public Sub SetIsConstant6() + Public Async Function TestSetIsConstant6() As Task Dim code = class C @@ -1816,11 +1817,11 @@ class C } - TestSetIsConstant(code, expected, True) - End Sub + Await TestSetIsConstant(code, expected, True) + End Function - Public Sub SetIsConstant7() + Public Async Function TestSetIsConstant7() As Task Dim code = class C @@ -1837,11 +1838,11 @@ class C } - TestSetIsConstant(code, expected, False) - End Sub + Await TestSetIsConstant(code, expected, False) + End Function - Public Sub SetIsConstant8() + Public Async Function TestSetIsConstant8() As Task Dim code = class C @@ -1858,15 +1859,15 @@ class C } - TestSetIsConstant(code, expected, True) - End Sub + Await TestSetIsConstant(code, expected, True) + End Function #End Region #Region "Set IsShared tests" - Public Sub SetIsShared1() + Public Async Function TestSetIsShared1() As Task Dim code = class C @@ -1883,11 +1884,11 @@ class C } - TestSetIsShared(code, expected, True) - End Sub + Await TestSetIsShared(code, expected, True) + End Function - Public Sub SetIsShared2() + Public Async Function TestSetIsShared2() As Task Dim code = class C @@ -1904,15 +1905,15 @@ class C } - TestSetIsShared(code, expected, False) - End Sub + Await TestSetIsShared(code, expected, False) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = class C @@ -1929,11 +1930,11 @@ class C } - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function - Public Sub SetName2() + Public Async Function TestSetName2() As Task Dim code = class C @@ -1954,15 +1955,15 @@ class C } - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region #Region "Set Type tests" - Public Sub SetType1() + Public Async Function TestSetType1() As Task Dim code = class C @@ -1979,11 +1980,11 @@ class C } - TestSetTypeProp(code, expected, "double") - End Sub + Await TestSetTypeProp(code, expected, "double") + End Function - Public Sub SetType2() + Public Async Function TestSetType2() As Task Dim code = class C @@ -2000,13 +2001,13 @@ class C } - TestSetTypeProp(code, expected, "double") - End Sub + Await TestSetTypeProp(code, expected, "double") + End Function #End Region - Public Sub TypeDescriptor_GetProperties() + Public Async Function TestTypeDescriptor_GetProperties() As Task Dim code = class S @@ -2021,8 +2022,8 @@ class S "ExtenderCATID", "Parent", "InitExpression", "Type", "Access", "IsConstant", "Attributes", "DocComment", "Comment", "IsShared", "ConstKind", "IsGeneric"} - TestPropertyDescriptors(code, expectedPropertyNames) - End Sub + Await TestPropertyDescriptors(code, expectedPropertyNames) + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/EventCollectorTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/EventCollectorTests.vb index 8c9ab6fb358ae13199f84da4bca1f646f74a688c..498a71900558967d7b9c65cdc5c228e414c12f03 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/EventCollectorTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/EventCollectorTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -8,7 +9,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp Inherits AbstractEventCollectorTests - Public Sub TestClass_Rename() + Public Async Function TestClass_Rename() As Task Dim code = class C @@ -23,12 +24,12 @@ class D } - Test(code, changedCode, + Await TestAsync(code, changedCode, Rename("D")) - End Sub + End Function - Public Sub TestClass_AddStaticModifier() + Public Async Function TestClass_AddStaticModifier() As Task Dim code = class C @@ -43,12 +44,12 @@ static class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown("C")) - End Sub + End Function - Public Sub TestClass_ChangeToStruct() + Public Async Function TestClass_ChangeToStruct() As Task Dim code = class C @@ -63,13 +64,13 @@ struct C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("C", Nothing), Add("C")) - End Sub + End Function - Public Sub TestClass_AddField() + Public Async Function TestClass_AddField() As Task Dim code = class C @@ -85,12 +86,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("i", "C")) - End Sub + End Function - Public Sub TestClass_AddSecondField() + Public Async Function TestClass_AddSecondField() As Task Dim code = class C @@ -107,12 +108,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("j", "C")) - End Sub + End Function - Public Sub TestClass_AddTwoDisjointFields() + Public Async Function TestClass_AddTwoDisjointFields() As Task Dim code = class C @@ -129,12 +130,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown("C")) - End Sub + End Function - Public Sub TestClass_AddTwoContiguousFields() + Public Async Function TestClass_AddTwoContiguousFields() As Task Dim code = class C @@ -151,13 +152,13 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("a", "C"), Add("b", "C")) - End Sub + End Function - Public Sub TestClass_RemoveTwoDisjointFields() + Public Async Function TestClass_RemoveTwoDisjointFields() As Task Dim code = class C @@ -174,12 +175,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown("C")) - End Sub + End Function - Public Sub TestClass_ReplaceFourFieldsWithProperty() + Public Async Function TestClass_ReplaceFourFieldsWithProperty() As Task Dim code = class C @@ -196,16 +197,16 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("i", "C"), Remove("x", "C"), Remove("j", "C"), Remove("y", "C"), Add("Foo", "C")) - End Sub + End Function - Public Sub TestClass_RemoveTwoContiguousFields() + Public Async Function TestClass_RemoveTwoContiguousFields() As Task Dim code = class C @@ -222,13 +223,13 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("a", "C"), Remove("b", "C")) - End Sub + End Function - Public Sub TestClass_RemoveField() + Public Async Function TestClass_RemoveField() As Task Dim code = class C @@ -244,12 +245,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("i", "C")) - End Sub + End Function - Public Sub TestClass_ReplaceFieldWithEvent() + Public Async Function TestClass_ReplaceFieldWithEvent() As Task Dim code = class C @@ -266,13 +267,13 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("E", "C"), Add("E", "C")) - End Sub + End Function - Public Sub TestClass_AddAutoProperty() + Public Async Function TestClass_AddAutoProperty() As Task Dim code = class C @@ -288,12 +289,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("Foo", "C")) - End Sub + End Function - Public Sub TestClass_AddIndexer() + Public Async Function TestClass_AddIndexer() As Task Dim code = class C @@ -309,12 +310,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("this", "C")) - End Sub + End Function - Public Sub TestField_AddConstModifier() + Public Async Function TestField_AddConstModifier() As Task Dim code = class C @@ -331,12 +332,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown("i")) - End Sub + End Function - Public Sub TestMethod_AddAccessModifier() + Public Async Function TestMethod_AddAccessModifier() As Task Dim code = class C @@ -353,12 +354,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown("M")) - End Sub + End Function - Public Sub TestMethod_AddParameter1() + Public Async Function TestMethod_AddParameter1() As Task Dim code = class C @@ -375,12 +376,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("i", "M")) - End Sub + End Function - Public Sub TestMethod_AddParameter2() + Public Async Function TestMethod_AddParameter2() As Task Dim code = class C @@ -397,12 +398,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("j", "M")) - End Sub + End Function - Public Sub TestMethod_RemoveParameter() + Public Async Function TestMethod_RemoveParameter() As Task Dim code = class C @@ -419,12 +420,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("i", "M")) - End Sub + End Function - Public Sub TestMethod_AddAttribute1() + Public Async Function TestMethod_AddAttribute1() As Task Dim code = class C @@ -442,12 +443,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System.CLSCompliant", "M")) - End Sub + End Function - Public Sub TestMethod_AddAttribute2() + Public Async Function TestMethod_AddAttribute2() As Task Dim code = class C @@ -466,12 +467,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System.Diagnostics.Conditional", "M")) - End Sub + End Function - Public Sub TestMethod_RemoveAttributes() + Public Async Function TestMethod_RemoveAttributes() As Task Dim code = class C @@ -489,13 +490,13 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("System.Diagnostics.Conditional", "M"), Remove("System.CLSCompliant", "M")) - End Sub + End Function - Public Sub TestMethod_ChangeAttribute() + Public Async Function TestMethod_ChangeAttribute() As Task Dim code = class C @@ -514,12 +515,12 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, ArgChange("System.Diagnostics.Conditional")) - End Sub + End Function - Public Sub LargeTopLevelReplace() + Public Async Function TestLargeTopLevelReplace() As Task Dim code = class A { } @@ -539,12 +540,12 @@ class J { } class K { } - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown(Nothing)) - End Sub + End Function - Public Sub ReplaceWithTwoClasses() + Public Async Function TestReplaceWithTwoClasses() As Task Dim code = namespace N @@ -562,12 +563,12 @@ namespace N } - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown("N")) - End Sub + End Function - Public Sub ChangingClassClassToPartial() + Public Async Function TestChangingClassClassToPartial() As Task Dim code = namespace N @@ -588,13 +589,13 @@ namespace N } - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("C", "N"), Add("C", "N")) - End Sub + End Function - Public Sub RenameDelegate() + Public Async Function TestRenameDelegate() As Task Dim code = namespace N @@ -611,12 +612,12 @@ namespace N } - Test(code, changedCode, + Await TestAsync(code, changedCode, Rename("Bar")) - End Sub + End Function - Public Sub Bug788750() + Public Async Function TestBug788750() As Task Dim code = class C @@ -663,12 +664,12 @@ class B } - Test(code, changedCode) - End Sub + Await TestAsync(code, changedCode) + End Function - Public Sub TestField_AddAttributeToField() + Public Async Function TestField_AddAttributeToField() As Task Dim code = class C @@ -686,13 +687,13 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System.CLSCompliant", "foo")) - End Sub + End Function - Public Sub TestField_AddAttributeToTwoFields() + Public Async Function TestField_AddAttributeToTwoFields() As Task Dim code = class C @@ -710,14 +711,14 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System.CLSCompliant", "foo"), Add("System.CLSCompliant", "bar")) - End Sub + End Function - Public Sub TestField_RemoveAttributeFromField() + Public Async Function TestField_RemoveAttributeFromField() As Task Dim code = class C @@ -735,13 +736,13 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("System.CLSCompliant", "foo")) - End Sub + End Function - Public Sub TestField_RemoveAttributeFromTwoFields() + Public Async Function TestField_RemoveAttributeFromTwoFields() As Task Dim code = class C @@ -759,14 +760,14 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("System.CLSCompliant", "foo"), Remove("System.CLSCompliant", "bar")) - End Sub + End Function - Public Sub TestField_ChangeAttributeOnField() + Public Async Function TestField_ChangeAttributeOnField() As Task Dim code = class C @@ -785,14 +786,14 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, ArgChange("System.CLSCompliant", "foo")) - End Sub + End Function - Public Sub TestField_ChangeAttributeOnTwoFields() + Public Async Function TestField_ChangeAttributeOnTwoFields() As Task Dim code = class C @@ -811,14 +812,14 @@ class C } - Test(code, changedCode, + Await TestAsync(code, changedCode, ArgChange("System.CLSCompliant", "foo"), ArgChange("System.CLSCompliant", "bar")) - End Sub + End Function - Public Sub TestField_AddOneMoreAttribute() + Public Async Function TestField_AddOneMoreAttribute() As Task Dim code = using System; @@ -841,13 +842,13 @@ class Program } - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System.CLSCompliant", "bar")) - End Sub + End Function - Public Sub TestField_RemoveOneAttribute() + Public Async Function TestField_RemoveOneAttribute() As Task Dim code = using System; @@ -870,9 +871,9 @@ class Program } - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("System.CLSCompliant", "bar")) - End Sub + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/ExternalCodeClassTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/ExternalCodeClassTests.vb index 66e953c9fab1117adfef37f45b00121f195875f9..e99825e9a5d08b516f94d6a238ca2ee6b9e60076 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/ExternalCodeClassTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/ExternalCodeClassTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,7 +11,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "Doc Comment" - Public Sub DocComment1() + Public Async Function TestDocComment1() As Task Dim code = /// <summary>This is my comment!</summary> @@ -19,11 +20,11 @@ class C$$ } - TestDocComment(code, "" & vbCrLf & " This is my comment!" & vbCrLf & "") - End Sub + Await TestDocComment(code, "" & vbCrLf & " This is my comment!" & vbCrLf & "") + End Function - Public Sub DocComment2() + Public Async Function TestDocComment2() As Task Dim code = /// <summary>This is my comment!</summary> @@ -33,13 +34,13 @@ class C$$ } - TestDocComment(code, "" & vbCrLf & " This is my comment!" & vbCrLf & " " & vbCrLf & "") - End Sub + Await TestDocComment(code, "" & vbCrLf & " This is my comment!" & vbCrLf & " " & vbCrLf & "") + End Function #End Region - Public Sub ExpectedClassMembers() + Public Async Function TestExpectedClassMembers() As Task Dim code = class C$$ @@ -60,7 +61,7 @@ class C$$ } - TestElement(code, + Await TestElement(code, Sub(codeElement) Dim members = codeElement.Members Assert.Equal(7, members.Count) @@ -93,7 +94,7 @@ class C$$ Assert.Equal("C", member7.Name) Assert.Equal(EnvDTE.vsCMElement.vsCMElementFunction, member7.Kind) End Sub) - End Sub + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/FileCodeModelTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/FileCodeModelTests.vb index d85277e5250da1622aa93cfbd4ef9e3a20ce57a3..19a867a546b14d60485c1d04d3afb376565c2cc8 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/FileCodeModelTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/FileCodeModelTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel @@ -12,7 +13,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp Inherits AbstractFileCodeModelTests - Public Sub TestEnumerationWithCountAndItem() + Public Async Function TestEnumerationWithCountAndItem() As Task Dim code = namespace N { } @@ -22,7 +23,7 @@ struct S { } enum E { } delegate void D(); - Using workspaceAndFileCodeModel = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Using workspaceAndFileCodeModel = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim codeElements = workspaceAndFileCodeModel.FileCodeModel.CodeElements Dim count = codeElements.Count Assert.Equal(6, count) @@ -49,10 +50,10 @@ delegate void D(); j += 1 Next End Using - End Sub + End Function - Public Sub AssemblyLevelAttribute() + Public Async Function TestAssemblyLevelAttribute() As Task Dim code = [assembly: Foo(0, true, S = "x")] @@ -65,7 +66,7 @@ class FooAttribute : System.Attribute } - Using workspaceAndFileCodeModel = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Using workspaceAndFileCodeModel = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim codeElements = workspaceAndFileCodeModel.FileCodeModel.CodeElements Dim count = codeElements.Count Assert.Equal(2, count) @@ -97,12 +98,12 @@ class FooAttribute : System.Attribute Assert.Equal("S", arg3.Name) Assert.Equal("""x""", arg3.Value) End Using - End Sub + End Function #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = class $$C @@ -119,11 +120,11 @@ class C } - TestAddAttribute(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "true"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "true"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = class $$C @@ -139,11 +140,11 @@ class C { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "true", .Position = "C"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "true", .Position = "C"}) + End Function - Public Sub AddAttribute3() + Public Async Function TestAddAttribute3() As Task Dim code = $$[assembly: System.Reflection.AssemblyCompany("Microsoft")] @@ -156,11 +157,11 @@ $$[assembly: System.Reflection.AssemblyCompany("Microsoft")] - TestAddAttribute(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "true", .Position = -1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "true", .Position = -1}) + End Function - Public Sub AddAttribute4() + Public Async Function TestAddAttribute4() As Task Dim code = $$[assembly: System.Reflection.AssemblyCompany("Microsoft")] @@ -176,11 +177,11 @@ class C { } class C { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "true", .Position = -1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "true", .Position = -1}) + End Function - Public Sub AddAttribute5() + Public Async Function TestAddAttribute5() As Task Dim code = $$[assembly: System.Reflection.AssemblyCompany("Microsoft")] @@ -198,11 +199,11 @@ class C { } class C { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "true", .Position = -1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "true", .Position = -1}) + End Function - Public Sub AddAttribute6() + Public Async Function TestAddAttribute6() As Task Dim code = /// <summary></summary> @@ -216,15 +217,15 @@ class $$C { } class C { } - TestAddAttribute(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "true"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "true"}) + End Function #End Region #Region "AddClass tests" - Public Sub AddClass1() + Public Async Function TestAddClass1() As Task Dim code = class $$C @@ -243,11 +244,11 @@ class C } - TestAddClass(code, expected, New ClassData With {.Name = "B"}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "B"}) + End Function - Public Sub AddClass2() + Public Async Function TestAddClass2() As Task Dim code = class $$C { } @@ -262,11 +263,11 @@ class B class C { } - TestAddClass(code, expected, New ClassData With {.Name = "B"}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "B"}) + End Function - Public Sub AddClass3() + Public Async Function TestAddClass3() As Task Dim code = class $$C @@ -285,11 +286,11 @@ class B } - TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C"}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C"}) + End Function - Public Sub AddClass4() + Public Async Function TestAddClass4() As Task Dim code = class $$C { } @@ -304,11 +305,11 @@ class B } - TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C"}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C"}) + End Function - Public Sub AddClass5() + Public Async Function TestAddClass5() As Task Dim code = class $$C @@ -327,11 +328,11 @@ class B : C } - TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C", .Bases = {"C"}}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C", .Bases = {"C"}}) + End Function - Public Sub AddClass6() + Public Async Function TestAddClass6() As Task Dim code = class $$C @@ -350,11 +351,11 @@ class B : C } - TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C", .Bases = "C"}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C", .Bases = "C"}) + End Function - Public Sub AddClass7() + Public Async Function TestAddClass7() As Task Dim code = interface $$I @@ -373,11 +374,11 @@ class C : I } - TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "I", .Bases = {"I"}}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "I", .Bases = {"I"}}) + End Function - Public Sub AddClass8() + Public Async Function TestAddClass8() As Task Dim code = interface $$I @@ -396,11 +397,11 @@ class C : I } - TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "I", .Bases = "I"}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "I", .Bases = "I"}) + End Function - Public Sub AddClass9() + Public Async Function TestAddClass9() As Task Dim code = class B { } @@ -417,11 +418,11 @@ class C : B, I } - TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "I", .Bases = "B", .ImplementedInterfaces = "I"}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "I", .Bases = "B", .ImplementedInterfaces = "I"}) + End Function - Public Sub AddClass10() + Public Async Function TestAddClass10() As Task Dim code = class B { } @@ -440,11 +441,11 @@ class C : B, IFoo, IBar } - TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "IBar", .Bases = "B", .ImplementedInterfaces = {"IFoo", "IBar"}}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "IBar", .Bases = "B", .ImplementedInterfaces = {"IFoo", "IBar"}}) + End Function - Public Sub AddClass_Stress() + Public Async Function TestAddClass_Stress() As Task Dim code = class B { } @@ -452,7 +453,7 @@ interface $$IFoo { } interface IBar { } - TestOperation(code, + Await TestOperation(code, Sub(fileCodeModel) For i = 1 To 100 Dim name = $"C{i}" @@ -461,14 +462,14 @@ interface IBar { } Assert.Equal(name, newClass.Name) Next End Sub) - End Sub + End Function #End Region #Region "AddDelegate tests" - Public Sub AddDelegate1() + Public Async Function TestAddDelegate1() As Task Dim code = class $$C @@ -485,11 +486,11 @@ class C } - TestAddDelegate(code, expected, New DelegateData With {.Name = "D", .Type = "void"}) - End Sub + Await TestAddDelegate(code, expected, New DelegateData With {.Name = "D", .Type = "void"}) + End Function - Public Sub AddDelegate2() + Public Async Function TestAddDelegate2() As Task Dim code = class $$C @@ -506,15 +507,15 @@ class C delegate int D(); - TestAddDelegate(code, expected, New DelegateData With {.Name = "D", .Type = "int", .Position = "C"}) - End Sub + Await TestAddDelegate(code, expected, New DelegateData With {.Name = "D", .Type = "int", .Position = "C"}) + End Function #End Region #Region "AddEnum tests" - Public Sub AddEnum1() + Public Async Function TestAddEnum1() As Task Dim code = class $$C @@ -533,11 +534,11 @@ class C } - TestAddEnum(code, expected, New EnumData With {.Name = "E"}) - End Sub + Await TestAddEnum(code, expected, New EnumData With {.Name = "E"}) + End Function - Public Sub AddEnum2() + Public Async Function TestAddEnum2() As Task Dim code = class $$C @@ -556,15 +557,15 @@ enum E } - TestAddEnum(code, expected, New EnumData With {.Name = "E", .Position = "C"}) - End Sub + Await TestAddEnum(code, expected, New EnumData With {.Name = "E", .Position = "C"}) + End Function #End Region #Region "AddImport tests" - Public Sub AddImport1() + Public Async Function TestAddImport1() As Task Dim code = class $$C @@ -581,11 +582,11 @@ class C } - TestAddImport(code, expected, New ImportData With {.[Namespace] = "System"}) - End Sub + Await TestAddImport(code, expected, New ImportData With {.[Namespace] = "System"}) + End Function - Public Sub AddImport2() + Public Async Function TestAddImport2() As Task Dim code = class $$C @@ -602,11 +603,11 @@ class C } - TestAddImport(code, expected, New ImportData With {.[Namespace] = "System", .Alias = "S"}) - End Sub + Await TestAddImport(code, expected, New ImportData With {.[Namespace] = "System", .Alias = "S"}) + End Function - Public Sub AddImport3() + Public Async Function TestAddImport3() As Task Dim code = using System.Collections.Generic; @@ -626,11 +627,11 @@ class C } - TestAddImport(code, expected, New ImportData With {.[Namespace] = "System"}) - End Sub + Await TestAddImport(code, expected, New ImportData With {.[Namespace] = "System"}) + End Function - Public Sub AddImport4() + Public Async Function TestAddImport4() As Task Dim code = using System.Collections.Generic; @@ -650,15 +651,15 @@ class C } - TestAddImport(code, expected, New ImportData With {.[Namespace] = "System", .Position = -1}) - End Sub + Await TestAddImport(code, expected, New ImportData With {.[Namespace] = "System", .Position = -1}) + End Function #End Region #Region "AddInterface tests" - Public Sub AddInterface1() + Public Async Function TestAddInterface1() As Task Dim code = class $$C @@ -677,11 +678,11 @@ class C } - TestAddInterface(code, expected, New InterfaceData With {.Name = "I"}) - End Sub + Await TestAddInterface(code, expected, New InterfaceData With {.Name = "I"}) + End Function - Public Sub AddInterface2() + Public Async Function TestAddInterface2() As Task Dim code = class $$C @@ -700,15 +701,15 @@ interface I } - TestAddInterface(code, expected, New InterfaceData With {.Name = "I", .Position = "C"}) - End Sub + Await TestAddInterface(code, expected, New InterfaceData With {.Name = "I", .Position = "C"}) + End Function #End Region #Region "AddNamespace tests" - Public Sub AddNamespace1() + Public Async Function TestAddNamespace1() As Task Dim code = class $$C @@ -727,11 +728,11 @@ class C } - TestAddNamespace(code, expected, New NamespaceData With {.Name = "N"}) - End Sub + Await TestAddNamespace(code, expected, New NamespaceData With {.Name = "N"}) + End Function - Public Sub AddNamespace2() + Public Async Function TestAddNamespace2() As Task Dim code = class $$C @@ -750,11 +751,11 @@ class C } - TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = 0}) - End Sub + Await TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = 0}) + End Function - Public Sub AddNamespace3() + Public Async Function TestAddNamespace3() As Task Dim code = class $$C @@ -773,11 +774,11 @@ namespace N } - TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = "C"}) - End Sub + Await TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = "C"}) + End Function - Public Sub AddNamespace4() + Public Async Function TestAddNamespace4() As Task Dim code = $$ @@ -788,11 +789,11 @@ namespace N } - TestAddNamespace(code, expected, New NamespaceData With {.Name = "N"}) - End Sub + Await TestAddNamespace(code, expected, New NamespaceData With {.Name = "N"}) + End Function - Public Sub AddNamespace5() + Public Async Function TestAddNamespace5() As Task Dim code = $$using System; @@ -807,11 +808,11 @@ namespace N } - TestAddNamespace(code, expected, New NamespaceData With {.Name = "N"}) - End Sub + Await TestAddNamespace(code, expected, New NamespaceData With {.Name = "N"}) + End Function - Public Sub AddNamespace6() + Public Async Function TestAddNamespace6() As Task Dim code = $$using System; @@ -826,11 +827,11 @@ namespace N } - TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = 0}) - End Sub + Await TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = 0}) + End Function - Public Sub AddNamespace7() + Public Async Function TestAddNamespace7() As Task Dim code = $$using System; @@ -845,15 +846,15 @@ namespace N } - TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = Type.Missing}) - End Sub + Await TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = Type.Missing}) + End Function #End Region #Region "AddStruct tests" - Public Sub AddStruct1() + Public Async Function TestAddStruct1() As Task Dim code = class $$C @@ -872,11 +873,11 @@ class C } - TestAddStruct(code, expected, New StructData With {.Name = "S"}) - End Sub + Await TestAddStruct(code, expected, New StructData With {.Name = "S"}) + End Function - Public Sub AddStruct2() + Public Async Function TestAddStruct2() As Task Dim code = class $$C @@ -895,15 +896,15 @@ struct S } - TestAddStruct(code, expected, New StructData With {.Name = "S", .Position = "C"}) - End Sub + Await TestAddStruct(code, expected, New StructData With {.Name = "S", .Position = "C"}) + End Function #End Region #Region "Remove tests" - Public Sub Remove1() + Public Async Function TestRemove1() As Task Dim code = class $$C @@ -915,11 +916,11 @@ class $$C - TestRemoveChild(code, expected, "C") - End Sub + Await TestRemoveChild(code, expected, "C") + End Function - Public Sub Remove2() + Public Async Function TestRemove2() As Task Dim code = /// <summary> @@ -934,14 +935,14 @@ Class $$C - TestRemoveChild(code, expected, "C") - End Sub + Await TestRemoveChild(code, expected, "C") + End Function #End Region - Public Sub ClosedDocument() + Public Async Function TestClosedDocument() As Task Dim code = class $$C @@ -949,7 +950,7 @@ class $$C void M() { } } - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim codeClass = state.GetCodeElementAtCursor(Of EnvDTE80.CodeClass2) Assert.Equal(1, codeClass.Members.OfType(Of EnvDTE80.CodeFunction2)().Count()) Dim project = state.VisualStudioWorkspace.CurrentSolution.Projects.First() @@ -963,11 +964,11 @@ class $$C Dim count = codeClass.Members.OfType(Of EnvDTE80.CodeFunction2)().Count() End Sub) End Using - End Sub + End Function - Public Sub CreateUnknownElementForConversionOperator() + Public Async Function TestCreateUnknownElementForConversionOperator() As Task Dim oldCode = class D @@ -992,7 +993,7 @@ class D - Using originalWorkspaceAndFileCodeModel = CreateCodeModelTestState(GetWorkspaceDefinition(oldCode)) + Using originalWorkspaceAndFileCodeModel = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(oldCode)) Using changedworkspace = TestWorkspaceFactory.CreateWorkspace(changedDefinition, exportProvider:=VisualStudioTestExportProvider.ExportProvider) Dim originalDocument = originalWorkspaceAndFileCodeModel.Workspace.CurrentSolution.GetDocument(originalWorkspaceAndFileCodeModel.Workspace.Documents(0).Id) @@ -1014,11 +1015,11 @@ class D Assert.Equal(unknownCodeFunction.Name, "implicit operator D") End Using End Using - End Sub + End Function - Public Sub ChangeClassNameAndGetNameOfChildFunction() + Public Async Function TestChangeClassNameAndGetNameOfChildFunction() As Task Dim code = class C @@ -1027,7 +1028,7 @@ class C } - TestOperation(code, + Await TestOperation(code, Sub(fileCodeModel) Dim codeClass = TryCast(fileCodeModel.CodeElements.Item(1), EnvDTE.CodeClass) Assert.NotNull(codeClass) @@ -1041,11 +1042,11 @@ class C Assert.Equal("NewClassName", codeClass.Name) Assert.Equal("M", codeFunction.Name) End Sub) - End Sub + End Function - Public Sub TestCodeElements_PropertyAccessor() + Public Async Function TestCodeElements_PropertyAccessor() As Task Dim code = class C @@ -1057,7 +1058,7 @@ class C } - TestOperation(code, + Await TestOperation(code, Sub(fileCodeModel) Dim classC = TryCast(fileCodeModel.CodeElements.Item(1), EnvDTE.CodeClass) Assert.NotNull(classC) @@ -1094,11 +1095,11 @@ class C Assert.Equal("C.P", member2.NodeKey.Name) Assert.Equal(1, member2.NodeKey.Ordinal) End Sub) - End Sub + End Function - Public Sub TestCodeElements_EventAccessor() + Public Async Function TestCodeElements_EventAccessor() As Task Dim code = class C @@ -1111,7 +1112,7 @@ class C } - TestOperation(code, + Await TestOperation(code, Sub(fileCodeModel) Dim classC = TryCast(fileCodeModel.CodeElements.Item(1), EnvDTE.CodeClass) Assert.NotNull(classC) @@ -1148,7 +1149,7 @@ class C Assert.Equal("C.E", member2.NodeKey.Name) Assert.Equal(1, member2.NodeKey.Ordinal) End Sub) - End Sub + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/RootCodeModelTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/RootCodeModelTests.vb index a148da52e8e0fc5fe6d2555f69ee772331d760d8..35bc25cd08fd03a7259bae49d122e665f02c3099 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/RootCodeModelTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/RootCodeModelTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel Imports Microsoft.VisualStudio.LanguageServices.Implementation.Interop @@ -12,22 +13,22 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp #Region "CodeElements tests" - Public Sub CodeElements1() + Public Async Function TestCodeElements1() As Task Dim code = class Foo { } - TestCodeElements(code, + Await TestCodeElements(code, "Foo", "System", "Microsoft") - End Sub + End Function #End Region - Public Sub TestDotNetNameFromLanguageSpecific() + Public Async Function TestDotNetNameFromLanguageSpecific() As Task Dim code = using N.M; @@ -41,21 +42,21 @@ namespace N } - TestRootCodeModelWithCodeFile(code, + Await TestRootCodeModelWithCodeFile(code, Sub(rootCodeModel) Dim dotNetName = rootCodeModel.DotNetNameFromLanguageSpecific("N.M.Generic") Assert.Equal("N.M.Generic`1[System.String]", dotNetName) End Sub) - End Sub + End Function - Public Sub TestExternalNamespaceChildren() + Public Async Function TestExternalNamespaceChildren() As Task Dim code = class Foo { } - TestRootCodeModelWithCodeFile(code, + Await TestRootCodeModelWithCodeFile(code, Sub(rootCodeModel) Dim systemNamespace = rootCodeModel.CodeElements.Find(Of EnvDTE.CodeNamespace)("System") Assert.NotNull(systemNamespace) @@ -69,53 +70,53 @@ class Foo { } Dim listClass = genericNamespace.Members.Find(Of EnvDTE.CodeClass)("List") Assert.NotNull(listClass) End Sub) - End Sub + End Function #Region "CreateCodeTypeRef" - Public Sub CreateCodeTypeRef_Int32() - TestCreateCodeTypeRef("System.Int32", + Public Async Function TestCreateCodeTypeRef_Int32() As Task + Await TestCreateCodeTypeRef("System.Int32", New CodeTypeRefData With { .AsString = "int", .AsFullName = "System.Int32", .CodeTypeFullName = "System.Int32", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefInt }) - End Sub + End Function - Public Sub CreateCodeTypeRef_System_Text_StringBuilder() - TestCreateCodeTypeRef("System.Text.StringBuilder", + Public Async Function TestCreateCodeTypeRef_System_Text_StringBuilder() As Task + Await TestCreateCodeTypeRef("System.Text.StringBuilder", New CodeTypeRefData With { .AsString = "System.Text.StringBuilder", .AsFullName = "System.Text.StringBuilder", .CodeTypeFullName = "System.Text.StringBuilder", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType }) - End Sub + End Function - Public Sub CreateCodeTypeRef_NullableInteger() - TestCreateCodeTypeRef("int?", + Public Async Function TestCreateCodeTypeRef_NullableInteger() As Task + Await TestCreateCodeTypeRef("int?", New CodeTypeRefData With { .AsString = "int?", .AsFullName = "System.Nullable", .CodeTypeFullName = "System.Int32?", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType }) - End Sub + End Function - Public Sub CreateCodeTypeRef_ListOfInt() - TestCreateCodeTypeRef("System.Collections.Generic.List", + Public Async Function TestCreateCodeTypeRef_ListOfInt() As Task + Await TestCreateCodeTypeRef("System.Collections.Generic.List", New CodeTypeRefData With { .AsString = "System.Collections.Generic.List", .AsFullName = "System.Collections.Generic.List", .CodeTypeFullName = "System.Collections.Generic.List", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType }) - End Sub + End Function #End Region @@ -123,7 +124,7 @@ class Foo { } - Public Sub TestCodeTypeFromFullName_NonGenerated() + Public Async Function TestCodeTypeFromFullName_NonGenerated() As Task Dim workspace = CommonReferences="true"> @@ -138,7 +139,7 @@ namespace N - TestCodeTypeFromFullName(workspace, "N.C", + Await TestCodeTypeFromFullName(workspace, "N.C", Sub(codeType) Assert.NotNull(codeType) Assert.Equal("N.C", codeType.FullName) @@ -156,12 +157,12 @@ namespace N Assert.Equal("C.cs", filePath) End Sub) - End Sub + End Function - Public Sub TestCodeTypeFromFullName_Generated() + Public Async Function TestCodeTypeFromFullName_Generated() As Task Dim workspace = CommonReferences="true"> @@ -176,7 +177,7 @@ namespace N - TestCodeTypeFromFullName(workspace, "N.C", + Await TestCodeTypeFromFullName(workspace, "N.C", Sub(codeType) Assert.NotNull(codeType) Assert.Equal("N.C", codeType.FullName) @@ -194,11 +195,11 @@ namespace N Assert.Equal("C.g.cs", filePath) End Sub) - End Sub + End Function - Public Sub TestCodeTypeFromFullName_NonGenerated_Generated() + Public Async Function TestCodeTypeFromFullName_NonGenerated_Generated() As Task Dim workspace = CommonReferences="true"> @@ -221,7 +222,7 @@ namespace N - TestCodeTypeFromFullName(workspace, "N.C", + Await TestCodeTypeFromFullName(workspace, "N.C", Sub(codeType) Assert.NotNull(codeType) Assert.Equal("N.C", codeType.FullName) @@ -239,11 +240,11 @@ namespace N Assert.Equal("C.cs", filePath) End Sub) - End Sub + End Function - Public Sub TestCodeTypeFromFullName_Generated_NonGenerated() + Public Async Function TestCodeTypeFromFullName_Generated_NonGenerated() As Task Dim workspace = CommonReferences="true"> @@ -266,7 +267,7 @@ namespace N - TestCodeTypeFromFullName(workspace, "N.C", + Await TestCodeTypeFromFullName(workspace, "N.C", Sub(codeType) Assert.NotNull(codeType) Assert.Equal("N.C", codeType.FullName) @@ -284,7 +285,7 @@ namespace N Assert.Equal("C.cs", filePath) End Sub) - End Sub + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/CSharp/SyntaxNodeKeyTests.vb b/src/VisualStudio/Core/Test/CodeModel/CSharp/SyntaxNodeKeyTests.vb index ed0cb1ac8c7a3ebdfa7759e65519eb5abc8d756c..8cf724bdfe7425d1266b367d65af93aaf1f008bf 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CSharp/SyntaxNodeKeyTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CSharp/SyntaxNodeKeyTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel @@ -9,7 +10,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp Public Class SyntaxNodeKeyTests - Public Sub TestClass() + Public Async Function TestClass() As Task Dim input = @@ -21,11 +22,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp - Test(input, "C", 1) - End Sub + Await TestAsync(input, "C", 1) + End Function - Public Sub TestPartialClass1() + Public Async Function TestPartialClass1() As Task Dim input = @@ -41,11 +42,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp - Test(input, "C", 1) - End Sub + Await TestAsync(input, "C", 1) + End Function - Public Sub TestPartialClass2() + Public Async Function TestPartialClass2() As Task Dim input = @@ -61,11 +62,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp - Test(input, "C", 2) - End Sub + Await TestAsync(input, "C", 2) + End Function - Public Sub TestClassInNamespace() + Public Async Function TestClassInNamespace() As Task Dim input = @@ -80,11 +81,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp - Test(input, "N1.C", 1) - End Sub + Await TestAsync(input, "N1.C", 1) + End Function - Public Sub TestMethod() + Public Async Function TestMethod() As Task Dim input = @@ -102,11 +103,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp - Test(input, "N1.C.M()", 1) - End Sub + Await TestAsync(input, "N1.C.M()", 1) + End Function - Public Sub TestMethodWithParameters() + Public Async Function TestMethodWithParameters() As Task Dim input = @@ -124,11 +125,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp - Test(input, "N1.C.M(ref int,string)", 1) - End Sub + Await TestAsync(input, "N1.C.M(ref int,string)", 1) + End Function - Public Sub TestGenericMethodWithParametersInGenericClass() + Public Async Function TestGenericMethodWithParametersInGenericClass() As Task Dim input = @@ -146,11 +147,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp - Test(input, "N1.C`2.M`3(ref int,string)", 1) - End Sub + Await TestAsync(input, "N1.C`2.M`3(ref int,string)", 1) + End Function - Public Sub TestEscapedNames() + Public Async Function TestEscapedNames() As Task Dim input = @@ -168,11 +169,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp - Test(input, "int.class.void", 1) - End Sub + Await TestAsync(input, "int.class.void", 1) + End Function - Public Sub TestConversionOperator1() + Public Async Function TestConversionOperator1() As Task Dim input = @@ -193,11 +194,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp - Test(input, "C.#op_Explicit_string(C)", 1) - End Sub + Await TestAsync(input, "C.#op_Explicit_string(C)", 1) + End Function - Public Sub TestConversionOperator2() + Public Async Function TestConversionOperator2() As Task Dim input = @@ -218,11 +219,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp - Test(input, "C.#op_Implicit_int(C)", 1) - End Sub + Await TestAsync(input, "C.#op_Implicit_int(C)", 1) + End Function - Private Sub Test(definition As XElement, expectedName As String, expectedOrdinal As Integer) - Using workspace = TestWorkspaceFactory.CreateWorkspace(definition, exportProvider:=VisualStudioTestExportProvider.ExportProvider) + Private Async Function TestAsync(definition As XElement, expectedName As String, expectedOrdinal As Integer) As Task + Using workspace = Await TestWorkspaceFactory.CreateWorkspaceAsync(definition, exportProvider:=VisualStudioTestExportProvider.ExportProvider) Dim project = workspace.CurrentSolution.Projects.First() Dim codeModelService = project.LanguageServices.GetService(Of ICodeModelService)() Assert.NotNull(codeModelService) @@ -239,7 +240,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp Assert.Equal(expectedName, nodeKey.Name) Assert.Equal(expectedOrdinal, nodeKey.Ordinal) End Using - End Sub + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/CodeModelTestHelpers.vb b/src/VisualStudio/Core/Test/CodeModel/CodeModelTestHelpers.vb index 57b93eaea261cf5785923b559610b608fa11ee51..11f5a0df164fe3582f3f723ff1511162dea4d25c 100644 --- a/src/VisualStudio/Core/Test/CodeModel/CodeModelTestHelpers.vb +++ b/src/VisualStudio/Core/Test/CodeModel/CodeModelTestHelpers.vb @@ -33,8 +33,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel ' "probably not crash" as an improvement over "will crash when the finalizer throws." - Public Function CreateCodeModelTestState(definition As XElement) As CodeModelTestState - Dim workspace = TestWorkspaceFactory.CreateWorkspace(definition, exportProvider:=VisualStudioTestExportProvider.ExportProvider) + Public Async Function CreateCodeModelTestStateAsync(definition As XElement) As Threading.Tasks.Task(Of CodeModelTestState) + Dim workspace = Await TestWorkspaceFactory.CreateWorkspaceAsync(definition, exportProvider:=VisualStudioTestExportProvider.ExportProvider) Dim result As CodeModelTestState = Nothing Try diff --git a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests.vb b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests.vb index 5c2f36ccd5f8638d6c884c9d04137042aae93203..aec61acf4502e32861feb0f4ba61896e5eeff205 100644 --- a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests.vb @@ -5,14 +5,13 @@ Imports Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.MethodXML Partial Public Class MethodXMLTests - Private Sub Test(definition As XElement, expected As XElement) - Using state = CreateCodeModelTestState(definition) + Private Async Function TestAsync(definition As XElement, expected As XElement) As Threading.Tasks.Task + Using state = Await CreateCodeModelTestStateAsync(definition) Dim func = state.GetCodeElementAtCursor(Of EnvDTE.CodeFunction)() Dim actual = func.GetMethodXML() Assert.Equal(expected.ToString(), actual.ToString()) End Using - End Sub - + End Function End Class -End Namespace +End Namespace \ No newline at end of file diff --git a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSAssignments.vb b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSAssignments.vb index d8ddf65d3791f9b3e0bd94d834e14376656bb542..be27506573ce7f8ae56060ab381ff27c0415c8f1 100644 --- a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSAssignments.vb +++ b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSAssignments.vb @@ -1,12 +1,13 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +Imports System.Threading.Tasks Imports Roslyn.Test.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.MethodXML Partial Public Class MethodXMLTests - Public Sub CSAssignments_FieldWithThis() + Public Async Function TestCSAssignments_FieldWithThis() As Task Dim definition = @@ -47,11 +48,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_FieldWithoutThis() + Public Async Function TestCSAssignments_FieldWithoutThis() As Task Dim definition = @@ -92,11 +93,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_FieldWithObjectCreation() + Public Async Function TestCSAssignments_FieldWithObjectCreation() As Task Dim definition = @@ -137,11 +138,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_FieldWithEnumMember() + Public Async Function TestCSAssignments_FieldWithEnumMember() As Task Dim definition = @@ -187,11 +188,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_PropertyWithThis() + Public Async Function TestCSAssignments_PropertyWithThis() As Task Dim definition = @@ -232,11 +233,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_PropertyWithoutThis() + Public Async Function TestCSAssignments_PropertyWithoutThis() As Task Dim definition = @@ -277,11 +278,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_FieldThroughPropertyWithThis() + Public Async Function TestCSAssignments_FieldThroughPropertyWithThis() As Task Dim definition = @@ -328,11 +329,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_FieldThroughPropertyWithoutThis() + Public Async Function TestCSAssignments_FieldThroughPropertyWithoutThis() As Task Dim definition = @@ -379,11 +380,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_AssignLocalsWithField() + Public Async Function TestCSAssignments_AssignLocalsWithField() As Task Dim definition = @@ -434,11 +435,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_CompoundAdd() + Public Async Function TestCSAssignments_CompoundAdd() As Task Dim definition = @@ -484,11 +485,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_CompoundSubtract() + Public Async Function TestCSAssignments_CompoundSubtract() As Task Dim definition = @@ -519,11 +520,11 @@ public class C x -= 41; - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_ArrayElementAccess() + Public Async Function TestCSAssignments_ArrayElementAccess() As Task Dim definition = @@ -608,12 +609,12 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_PropertyOffParameter() + Public Async Function TestCSAssignments_PropertyOffParameter() As Task Dim definition = @@ -654,12 +655,12 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_NullableValue() + Public Async Function TestCSAssignments_NullableValue() As Task Dim definition = @@ -698,12 +699,12 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_ClosedGeneric1() + Public Async Function TestCSAssignments_ClosedGeneric1() As Task Dim definition = @@ -734,12 +735,12 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_ClosedGeneric2() + Public Async Function TestCSAssignments_ClosedGeneric2() As Task Dim definition = @@ -770,12 +771,12 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_ClosedGeneric3() + Public Async Function TestCSAssignments_ClosedGeneric3() As Task Dim definition = @@ -806,12 +807,12 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_ClosedGeneric4() + Public Async Function TestCSAssignments_ClosedGeneric4() As Task Dim definition = @@ -842,12 +843,12 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_Pointer1() + Public Async Function TestCSAssignments_Pointer1() As Task Dim definition = @@ -868,12 +869,12 @@ public class C int* i = &x; - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_Pointer2() + Public Async Function TestCSAssignments_Pointer2() As Task Dim definition = @@ -902,12 +903,12 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_Pointer3() + Public Async Function TestCSAssignments_Pointer3() As Task Dim definition = @@ -936,12 +937,12 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_TypeConfluence() + Public Async Function TestCSAssignments_TypeConfluence() As Task Dim definition = @@ -972,12 +973,12 @@ class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_EscapedNames() + Public Async Function TestCSAssignments_EscapedNames() As Task Dim definition = @@ -1028,12 +1029,12 @@ class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_ControlChar() + Public Async Function TestCSAssignments_ControlChar() As Task Dim definition = @@ -1079,12 +1080,12 @@ class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_PropertyAssignedWithEmptyArray() + Public Async Function TestCSAssignments_PropertyAssignedWithEmptyArray() As Task Dim definition = @@ -1139,12 +1140,12 @@ class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_RoundTrippedDoubles() + Public Async Function TestCSAssignments_RoundTrippedDoubles() As Task Dim definition = @@ -1173,12 +1174,12 @@ class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSAssignments_RoundTrippedSingles() + Public Async Function TestCSAssignments_RoundTrippedSingles() As Task Dim definition = @@ -1207,8 +1208,8 @@ class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSEvents.vb b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSEvents.vb index 6f21796940afb4ba73faf5801378f463e9d79acf..00a044320b36d18b90e6049ab93995a8d535b7d5 100644 --- a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSEvents.vb +++ b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSEvents.vb @@ -1,12 +1,13 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +Imports System.Threading.Tasks Imports Roslyn.Test.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.MethodXML Partial Public Class MethodXMLTests - Public Sub CSEvents_AddDelegate() + Public Async Function TestCSEvents_AddDelegate() As Task Dim definition = @@ -52,11 +53,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSEvents_AddDelegateForNonExistentEventHandler1() + Public Async Function TestCSEvents_AddDelegateForNonExistentEventHandler1() As Task Dim definition = @@ -99,11 +100,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSEvents_AddDelegateForNonExistentEventHandler2() + Public Async Function TestCSEvents_AddDelegateForNonExistentEventHandler2() As Task Dim definition = @@ -150,11 +151,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSEvents_AddDelegateForNonExistentEventHandler3() + Public Async Function TestCSEvents_AddDelegateForNonExistentEventHandler3() As Task Dim definition = @@ -205,8 +206,8 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSInvocations.vb b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSInvocations.vb index 815abaef33332cc727377c03ff2f7dee9b546643..a907cc2b9d421ba5d589352e75b61efcebcd1efa 100644 --- a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSInvocations.vb +++ b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSInvocations.vb @@ -1,12 +1,13 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +Imports System.Threading.Tasks Imports Roslyn.Test.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.MethodXML Partial Public Class MethodXMLTests - Public Sub CSInvocations_InvocationWithThis() + Public Async Function TestCSInvocations_InvocationWithThis() As Task Dim definition = @@ -44,11 +45,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSInvocations_InvocationWithThisAndArgs() + Public Async Function TestCSInvocations_InvocationWithThisAndArgs() As Task Dim definition = @@ -100,11 +101,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSInvocations_InvocationWithoutThis() + Public Async Function TestCSInvocations_InvocationWithoutThis() As Task Dim definition = @@ -142,11 +143,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSInvocations_WithArrayInitializer() + Public Async Function TestCSInvocations_WithArrayInitializer() As Task Dim definition = @@ -224,11 +225,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSInvocations_CastOfParenthesizedExpression() + Public Async Function TestCSInvocations_CastOfParenthesizedExpression() As Task Dim definition = @@ -308,8 +309,8 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSLocalDeclarations.vb b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSLocalDeclarations.vb index a63b8359fa84511977929babf7d55d0fa76fb330..e28a4155e2e4df9ebb10b7f7d0c7d45494c69a64 100644 --- a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSLocalDeclarations.vb +++ b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSLocalDeclarations.vb @@ -1,12 +1,13 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +Imports System.Threading.Tasks Imports Roslyn.Test.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.MethodXML Partial Public Class MethodXMLTests - Public Sub CSLocalDeclarations_NoInitializer() + Public Async Function TestCSLocalDeclarations_NoInitializer() As Task Dim definition = @@ -30,11 +31,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_WithInitializer() + Public Async Function TestCSLocalDeclarations_WithInitializer() As Task Dim definition = @@ -63,11 +64,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_EscapedKeywordName() + Public Async Function TestCSLocalDeclarations_EscapedKeywordName() As Task Dim definition = @@ -96,11 +97,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_ArrayNoInitializer() + Public Async Function TestCSLocalDeclarations_ArrayNoInitializer() As Task Dim definition = @@ -126,11 +127,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_ArrayWithInitializer() + Public Async Function TestCSLocalDeclarations_ArrayWithInitializer() As Task Dim definition = @@ -170,11 +171,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_WithBinaryPlusInitializer() + Public Async Function TestCSLocalDeclarations_WithBinaryPlusInitializer() As Task Dim definition = @@ -212,11 +213,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_WithBitwiseOrInitializer() + Public Async Function TestCSLocalDeclarations_WithBitwiseOrInitializer() As Task Dim definition = @@ -254,11 +255,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_WithBitwiseAndInitializer() + Public Async Function TestCSLocalDeclarations_WithBitwiseAndInitializer() As Task Dim definition = @@ -296,11 +297,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_WithCastInitializer() + Public Async Function TestCSLocalDeclarations_WithCastInitializer() As Task Dim definition = @@ -334,11 +335,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_WithObjectCreationInitializer() + Public Async Function TestCSLocalDeclarations_WithObjectCreationInitializer() As Task Dim definition = @@ -375,11 +376,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_WithParenthesizedInitializer() + Public Async Function TestCSLocalDeclarations_WithParenthesizedInitializer() As Task Dim definition = @@ -421,11 +422,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_WithNullInitializer() + Public Async Function TestCSLocalDeclarations_WithNullInitializer() As Task Dim definition = @@ -454,11 +455,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_WithNegativeInitializer() + Public Async Function TestCSLocalDeclarations_WithNegativeInitializer() As Task Dim definition = @@ -487,11 +488,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_WithBooleanInitializer() + Public Async Function TestCSLocalDeclarations_WithBooleanInitializer() As Task Dim definition = @@ -530,11 +531,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_WithStringInitializer() + Public Async Function TestCSLocalDeclarations_WithStringInitializer() As Task Dim definition = @@ -563,11 +564,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_WithCharInitializer() + Public Async Function TestCSLocalDeclarations_WithCharInitializer() As Task Dim definition = @@ -596,11 +597,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_WithArrayInitializer() + Public Async Function TestCSLocalDeclarations_WithArrayInitializer() As Task Dim definition = @@ -640,11 +641,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_DifferentBlocks() + Public Async Function TestCSLocalDeclarations_DifferentBlocks() As Task Dim definition = @@ -692,11 +693,11 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub CSLocalDeclarations_TypeOfInitializer() + Public Async Function TestCSLocalDeclarations_TypeOfInitializer() As Task Dim definition = @@ -723,8 +724,8 @@ public class C - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSQuotes.vb b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSQuotes.vb index 19c0e0fc472ebce64ea576c93b6e100765ef9293..19628ca43e7793b3f0c1191a39d89b6d4a893a8b 100644 --- a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSQuotes.vb +++ b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_CSQuotes.vb @@ -1,12 +1,13 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +Imports System.Threading.Tasks Imports Roslyn.Test.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.MethodXML Partial Public Class MethodXMLTests - Public Sub CSQuotes_ForLoopAndComments() + Public Async Function TestCSQuotes_ForLoopAndComments() As Task Dim definition = @@ -47,8 +48,8 @@ public class C Foo3 - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBAssignments.vb b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBAssignments.vb index ccf1b070d56c5b937b124e21def8eebb76b181a6..36336d8ede1b2a8c429916dfb034dde0f9c1e4d4 100644 --- a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBAssignments.vb +++ b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBAssignments.vb @@ -2,13 +2,14 @@ Imports System.Globalization Imports System.Threading +Imports System.Threading.Tasks Imports Roslyn.Test.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.MethodXML Partial Public Class MethodXMLTests - Public Sub VBAssignments_FieldWithoutMe() + Public Async Function TestVBAssignments_FieldWithoutMe() As Task Dim definition = @@ -48,11 +49,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_WithEventsFieldWithoutMe() + Public Async Function TestVBAssignments_WithEventsFieldWithoutMe() As Task Dim definition = @@ -92,11 +93,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_FieldWithMe() + Public Async Function TestVBAssignments_FieldWithMe() As Task Dim definition = @@ -136,11 +137,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_PropertyThroughFieldWithoutMe() + Public Async Function TestVBAssignments_PropertyThroughFieldWithoutMe() As Task Dim definition = @@ -187,11 +188,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_PropertyThroughFieldWithMe() + Public Async Function TestVBAssignments_PropertyThroughFieldWithMe() As Task Dim definition = @@ -238,11 +239,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_InferredWithBinaryPlusOperation() + Public Async Function TestVBAssignments_InferredWithBinaryPlusOperation() As Task Dim definition = @@ -279,11 +280,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_WithBinaryPlusOperation() + Public Async Function TestVBAssignments_WithBinaryPlusOperation() As Task Dim definition = @@ -320,11 +321,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_HexNumber() + Public Async Function TestVBAssignments_HexNumber() As Task Dim definition = @@ -352,12 +353,12 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_Bug462922() + Public Async Function TestVBAssignments_Bug462922() As Task Dim definition = @@ -414,11 +415,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_EnumsAndCasts() + Public Async Function TestVBAssignments_EnumsAndCasts() As Task Dim definition = @@ -515,12 +516,12 @@ End Enum - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_PropertyOffParameter() + Public Async Function TestVBAssignments_PropertyOffParameter() As Task Dim definition = @@ -559,12 +560,12 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_NullableValue() + Public Async Function TestVBAssignments_NullableValue() As Task Dim definition = @@ -601,12 +602,12 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_ClosedGeneric1() + Public Async Function TestVBAssignments_ClosedGeneric1() As Task Dim definition = @@ -634,12 +635,12 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_ClosedGeneric2() + Public Async Function TestVBAssignments_ClosedGeneric2() As Task Dim definition = @@ -667,12 +668,12 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_ClosedGeneric3() + Public Async Function TestVBAssignments_ClosedGeneric3() As Task Dim definition = @@ -700,12 +701,12 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_ClosedGeneric4() + Public Async Function TestVBAssignments_ClosedGeneric4() As Task Dim definition = @@ -733,12 +734,12 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_TypeConfluence() + Public Async Function TestVBAssignments_TypeConfluence() As Task Dim definition = @@ -766,12 +767,12 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_EscapedNames() + Public Async Function TestVBAssignments_EscapedNames() As Task Dim definition = @@ -819,11 +820,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_FloatingPointLiteralInGermanUICulture() + Public Async Function TestVBAssignments_FloatingPointLiteralInGermanUICulture() As Task Dim definition = @@ -867,14 +868,14 @@ End Class Dim oldCulture = currentThread.CurrentCulture Try currentThread.CurrentCulture = CultureInfo.GetCultureInfo("de-DE") - Test(definition, expected) + Await TestAsync(definition, expected) Finally currentThread.CurrentCulture = oldCulture End Try - End Sub + End Function - Public Sub VBAssignments_DontThrowWhenLeftHandSideDoesntBind() + Public Async Function TestVBAssignments_DontThrowWhenLeftHandSideDoesntBind() As Task Dim definition = @@ -932,15 +933,15 @@ End Class Dim oldCulture = currentThread.CurrentCulture Try currentThread.CurrentCulture = CultureInfo.GetCultureInfo("de-DE") - Test(definition, expected) + Await TestAsync(definition, expected) Finally currentThread.CurrentCulture = oldCulture End Try - End Sub + End Function - Public Sub VBAssignments_PropertyAssignedWithEmptyArray() + Public Async Function TestVBAssignments_PropertyAssignedWithEmptyArray() As Task Dim definition = @@ -987,12 +988,12 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_RoundTrippedDoubles() + Public Async Function TestVBAssignments_RoundTrippedDoubles() As Task Dim definition = @@ -1019,12 +1020,12 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_RoundTrippedSingles() + Public Async Function TestVBAssignments_RoundTrippedSingles() As Task Dim definition = @@ -1051,8 +1052,8 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBInitializeComponent.vb b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBInitializeComponent.vb index 2f9a1d8314701ae7fafa4597ac305ea92b72df59..66e234b1efc464871cbb1a651c69bb0e169e4fd7 100644 --- a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBInitializeComponent.vb +++ b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBInitializeComponent.vb @@ -1,12 +1,13 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +Imports System.Threading.Tasks Imports Roslyn.Test.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.MethodXML Partial Public Class MethodXMLTests - Public Sub VBInitializeComponent1() + Public Async Function TestVBInitializeComponent1() As Task Dim definition = @@ -45,11 +46,11 @@ End Class - Test(definition, s_initializeComponentXML1) - End Sub + Await TestAsync(definition, s_initializeComponentXML1) + End Function - Public Sub VBInitializeComponent2() + Public Async Function TestVBInitializeComponent2() As Task Dim definition = @@ -109,8 +110,8 @@ End Class - Test(definition, s_initializeComponentXML2) - End Sub + Await TestAsync(definition, s_initializeComponentXML2) + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBInvocations.vb b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBInvocations.vb index 96fea664545af2a145b6d1dabdd3c90cb05de348..ea4a8d2c5b3e2b47f7f6ad83ef34e323c1acf6a6 100644 --- a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBInvocations.vb +++ b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBInvocations.vb @@ -1,12 +1,13 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +Imports System.Threading.Tasks Imports Roslyn.Test.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.MethodXML Partial Public Class MethodXMLTests - Public Sub VBInvocations_InvocationWithoutMe() + Public Async Function TestVBInvocations_InvocationWithoutMe() As Task Dim definition = @@ -42,11 +43,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBInvocations_InvocationWithMe() + Public Async Function TestVBInvocations_InvocationWithMe() As Task Dim definition = @@ -82,11 +83,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBInvocations_WithArrayInitializer1() + Public Async Function TestVBInvocations_WithArrayInitializer1() As Task Dim definition = @@ -157,11 +158,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBInvocations_InvokeOnCast() + Public Async Function TestVBInvocations_InvokeOnCast() As Task Dim definition = @@ -227,11 +228,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBInvocations_InvokeFixInCast() + Public Async Function TestVBInvocations_InvokeFixInCast() As Task Dim definition = @@ -281,12 +282,12 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBAssignments_MethodCallWithoutTypeQualification() + Public Async Function TestVBAssignments_MethodCallWithoutTypeQualification() As Task Dim definition = @@ -342,8 +343,8 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBLocalDeclarations.vb b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBLocalDeclarations.vb index f55250aee3222e62ab518e9d43c0394d792d5309..829271ffe5e4fee2014a24a2459e6513f9decbea 100644 --- a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBLocalDeclarations.vb +++ b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBLocalDeclarations.vb @@ -1,12 +1,13 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +Imports System.Threading.Tasks Imports Roslyn.Test.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.MethodXML Partial Public Class MethodXMLTests - Public Sub VBLocalDeclarations_NoInitializer() + Public Async Function TestVBLocalDeclarations_NoInitializer() As Task Dim definition = @@ -29,11 +30,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_WithLiteralInitializer() + Public Async Function TestVBLocalDeclarations_WithLiteralInitializer() As Task Dim definition = @@ -61,11 +62,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_WithInvocationInitializer1() + Public Async Function TestVBLocalDeclarations_WithInvocationInitializer1() As Task Dim definition = @@ -104,11 +105,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_WithInvocationInitializer2() + Public Async Function TestVBLocalDeclarations_WithInvocationInitializer2() As Task Dim definition = @@ -154,11 +155,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_WithEscapedNameAndAsNewClause() + Public Async Function TestVBLocalDeclarations_WithEscapedNameAndAsNewClause() As Task ' Note: The behavior here is different than Dev10 where escaped keywords ' would not be escaped in the generated XML. @@ -189,11 +190,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_TwoInferredDeclarators() + Public Async Function TestVBLocalDeclarations_TwoInferredDeclarators() As Task Dim definition = @@ -230,11 +231,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_StaticLocal() + Public Async Function TestVBLocalDeclarations_StaticLocal() As Task Dim definition = @@ -262,11 +263,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_ConstLocal() + Public Async Function TestVBLocalDeclarations_ConstLocal() As Task ' NOTE: Dev10 didn't generate *any* XML for Const locals because it walked the ' lowered IL tree. We're now generating the same thing that C# does (which has ' generates a local without the "Const" modifier -- i.e. a bug). @@ -298,11 +299,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_TwoNamesWithAsNewClause() + Public Async Function TestVBLocalDeclarations_TwoNamesWithAsNewClause() As Task Dim definition = @@ -336,11 +337,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_ArrayWithNoBoundOrInitializer1() + Public Async Function TestVBLocalDeclarations_ArrayWithNoBoundOrInitializer1() As Task Dim definition = @@ -365,11 +366,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_ArrayWithNoBoundOrInitializer2() + Public Async Function TestVBLocalDeclarations_ArrayWithNoBoundOrInitializer2() As Task Dim definition = @@ -394,11 +395,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_ArrayWithSimpleBound() + Public Async Function TestVBLocalDeclarations_ArrayWithSimpleBound() As Task Dim definition = @@ -437,11 +438,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_ArrayWithRangeBound() + Public Async Function TestVBLocalDeclarations_ArrayWithRangeBound() As Task Dim definition = @@ -480,11 +481,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_ArrayWithSimpleAndRangeBounds() + Public Async Function TestVBLocalDeclarations_ArrayWithSimpleAndRangeBounds() As Task Dim definition = @@ -530,11 +531,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_ArrayWithStringBound() + Public Async Function TestVBLocalDeclarations_ArrayWithStringBound() As Task Dim definition = @@ -554,11 +555,11 @@ End Class Dim i("Foo") As Integer - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_ArrayWithStringAndCastBound() + Public Async Function TestVBLocalDeclarations_ArrayWithStringAndCastBound() As Task Dim definition = @@ -578,11 +579,11 @@ End Class Dim i(CInt("Foo")) As Integer - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_ArrayWithPropertyAccessBound() + Public Async Function TestVBLocalDeclarations_ArrayWithPropertyAccessBound() As Task Dim definition = @@ -602,11 +603,11 @@ End Class Dim i("Foo".Length) As Integer - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_ArrayWithNoBoundAndCollectionInitializer1() + Public Async Function TestVBLocalDeclarations_ArrayWithNoBoundAndCollectionInitializer1() As Task Dim definition = @@ -660,11 +661,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_ArrayWithNoBoundAndCollectionInitializer2() + Public Async Function TestVBLocalDeclarations_ArrayWithNoBoundAndCollectionInitializer2() As Task Dim definition = @@ -718,11 +719,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBLocalDeclarations_InitializeWithStringConcatenation() + Public Async Function TestVBLocalDeclarations_InitializeWithStringConcatenation() As Task Dim definition = @@ -758,8 +759,8 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function End Class End Namespace diff --git a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBStatements.vb b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBStatements.vb index 24ae7c683892e09db47e85d053f1fdc0c8258538..52a019faa326a387f907b100f179fdfce199691d 100644 --- a/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBStatements.vb +++ b/src/VisualStudio/Core/Test/CodeModel/MethodXML/MethodXMLTests_VBStatements.vb @@ -1,12 +1,13 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +Imports System.Threading.Tasks Imports Roslyn.Test.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.MethodXML Partial Public Class MethodXMLTests - Public Sub VBStatements_AddHandler1() + Public Async Function TestVBStatements_AddHandler1() As Task Dim definition = @@ -57,11 +58,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBStatements_AddHandler2() + Public Async Function TestVBStatements_AddHandler2() As Task Dim definition = @@ -120,11 +121,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBStatements_AddHandler3() + Public Async Function TestVBStatements_AddHandler3() As Task Dim definition = @@ -187,11 +188,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBStatements_AddHandler4() + Public Async Function TestVBStatements_AddHandler4() As Task Dim definition = @@ -262,11 +263,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBStatements_AddHandler5() + Public Async Function TestVBStatements_AddHandler5() As Task Dim definition = @@ -337,11 +338,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBStatements_RemoveHandler1() + Public Async Function TestVBStatements_RemoveHandler1() As Task Dim definition = @@ -392,11 +393,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBStatements_RemoveHandler2() + Public Async Function TestVBStatements_RemoveHandler2() As Task Dim definition = @@ -455,11 +456,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBStatements_RemoveHandler3() + Public Async Function TestVBStatements_RemoveHandler3() As Task Dim definition = @@ -522,11 +523,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBStatements_RemoveHandler4() + Public Async Function TestVBStatements_RemoveHandler4() As Task Dim definition = @@ -597,11 +598,11 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function - Public Sub VBStatements_RemoveHandler5() + Public Async Function TestVBStatements_RemoveHandler5() As Task Dim definition = @@ -672,8 +673,8 @@ End Class - Test(definition, expected) - End Sub + Await TestAsync(definition, expected) + End Function End Class End Namespace \ No newline at end of file diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeAccessorFunctionTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeAccessorFunctionTests.vb index 4ee0b61fa9a84c3fc73b90d4b0421c971a5b8f89..dafaa9848c844ec30980bf6aac6253586362e484 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeAccessorFunctionTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeAccessorFunctionTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,7 +11,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "GetStartPoint() Tests" - Public Sub GetStartPoint_PropertyGet() + Public Async Function TestGetStartPoint_PropertyGet() As Task Dim code = Public Class C1 @@ -23,7 +24,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -44,10 +45,10 @@ End Class TextPoint(line:=3, lineOffset:=9, absoluteOffset:=57, lineLength:=11)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=9, absoluteOffset:=57, lineLength:=11))) - End Sub + End Function - Public Sub GetStartPoint_PropertySet() + Public Async Function TestGetStartPoint_PropertySet() As Task Dim code = Public Class C1 @@ -60,7 +61,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -81,10 +82,10 @@ End Class TextPoint(line:=5, lineOffset:=9, absoluteOffset:=85, lineLength:=28)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=5, lineOffset:=9, absoluteOffset:=85, lineLength:=28))) - End Sub + End Function - Public Sub GetStartPoint_EventAddHandler() + Public Async Function TestGetStartPoint_EventAddHandler() As Task Dim code = Imports System @@ -101,7 +102,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -122,10 +123,10 @@ End Class TextPoint(line:=5, lineOffset:=7, absoluteOffset:=81, lineLength:=45)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=5, lineOffset:=7, absoluteOffset:=81, lineLength:=45))) - End Sub + End Function - Public Sub GetStartPoint_EventRemoveHandler() + Public Async Function TestGetStartPoint_EventRemoveHandler() As Task Dim code = Imports System @@ -142,7 +143,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -163,10 +164,10 @@ End Class TextPoint(line:=7, lineOffset:=7, absoluteOffset:=148, lineLength:=48)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=7, lineOffset:=7, absoluteOffset:=148, lineLength:=48))) - End Sub + End Function - Public Sub GetStartPoint_EventRaiseEvent() + Public Async Function TestGetStartPoint_EventRaiseEvent() As Task Dim code = Imports System @@ -183,7 +184,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -204,14 +205,14 @@ End Class TextPoint(line:=9, lineOffset:=7, absoluteOffset:=221, lineLength:=62)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=9, lineOffset:=7, absoluteOffset:=221, lineLength:=62))) - End Sub + End Function #End Region #Region "GetEndPoint() Tests" - Public Sub GetEndPoint_PropertyGet() + Public Async Function TestGetEndPoint_PropertyGet() As Task Dim code = Public Class C1 @@ -224,7 +225,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -245,10 +246,10 @@ End Class TextPoint(line:=4, lineOffset:=16, absoluteOffset:=76, lineLength:=15)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=4, lineOffset:=16, absoluteOffset:=76, lineLength:=15))) - End Sub + End Function - Public Sub GetEndPoint_PropertySet() + Public Async Function TestGetEndPoint_PropertySet() As Task Dim code = Public Class C1 @@ -261,7 +262,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -282,10 +283,10 @@ End Class TextPoint(line:=6, lineOffset:=16, absoluteOffset:=121, lineLength:=15)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=6, lineOffset:=16, absoluteOffset:=121, lineLength:=15))) - End Sub + End Function - Public Sub GetEndPoint_EventAddHandler() + Public Async Function TestGetEndPoint_EventAddHandler() As Task Dim code = Imports System @@ -302,7 +303,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -323,10 +324,10 @@ End Class TextPoint(line:=6, lineOffset:=21, absoluteOffset:=141, lineLength:=20)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=6, lineOffset:=21, absoluteOffset:=141, lineLength:=20))) - End Sub + End Function - Public Sub GetEndPoint_EventRemoveHandler() + Public Async Function TestGetEndPoint_EventRemoveHandler() As Task Dim code = Imports System @@ -343,7 +344,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -364,10 +365,10 @@ End Class TextPoint(line:=8, lineOffset:=24, absoluteOffset:=214, lineLength:=23)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=8, lineOffset:=24, absoluteOffset:=214, lineLength:=23))) - End Sub + End Function - Public Sub GetEndPoint_EventRaiseEvent() + Public Async Function TestGetEndPoint_EventRaiseEvent() As Task Dim code = Imports System @@ -384,7 +385,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -405,14 +406,14 @@ End Class TextPoint(line:=10, lineOffset:=21, absoluteOffset:=298, lineLength:=20)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=10, lineOffset:=21, absoluteOffset:=298, lineLength:=20))) - End Sub + End Function #End Region #Region "Access tests" - Public Sub Access1() + Public Async Function TestAccess1() As Task Dim code = Class C @@ -427,11 +428,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access2() + Public Async Function TestAccess2() As Task Dim code = Class C @@ -446,15 +447,15 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function #End Region #Region "FunctionKind tests" - Public Sub FunctionKind_Get() + Public Async Function TestFunctionKind_Get() As Task Dim code = Public Class C1 @@ -467,11 +468,11 @@ Public Class C1 End Class - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionPropertyGet) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionPropertyGet) + End Function - Public Sub FunctionKind_Set() + Public Async Function TestFunctionKind_Set() As Task Dim code = Public Class C1 @@ -484,11 +485,11 @@ Public Class C1 End Class - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionPropertySet) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionPropertySet) + End Function - Public Sub FunctionKind_AddHandler() + Public Async Function TestFunctionKind_AddHandler() As Task Dim code = Imports System @@ -511,11 +512,11 @@ Public Class C1 End Clas - TestFunctionKind(code, EnvDTE80.vsCMFunction2.vsCMFunctionAddHandler) - End Sub + Await TestFunctionKind(code, EnvDTE80.vsCMFunction2.vsCMFunctionAddHandler) + End Function - Public Sub FunctionKind_RemoveHandler() + Public Async Function TestFunctionKind_RemoveHandler() As Task Dim code = Imports System @@ -538,11 +539,11 @@ Public Class C1 End Clas - TestFunctionKind(code, EnvDTE80.vsCMFunction2.vsCMFunctionRemoveHandler) - End Sub + Await TestFunctionKind(code, EnvDTE80.vsCMFunction2.vsCMFunctionRemoveHandler) + End Function - Public Sub FunctionKind_RaiseEvent() + Public Async Function TestFunctionKind_RaiseEvent() As Task Dim code = Imports System @@ -565,8 +566,8 @@ Public Class C1 End Clas - TestFunctionKind(code, EnvDTE80.vsCMFunction2.vsCMFunctionRaiseEvent) - End Sub + Await TestFunctionKind(code, EnvDTE80.vsCMFunction2.vsCMFunctionRaiseEvent) + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeAttributeTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeAttributeTests.vb index 9efac91744cd1f11bf014ee540a8b8297118b453..472a20e3cda90af5f18636a02da2823a764dd945 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeAttributeTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeAttributeTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,7 +11,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "GetStartPoint() tests" - Public Sub GetStartPoint1() + Public Async Function TestGetStartPoint1() As Task Dim code = Imports System @@ -19,7 +20,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -40,10 +41,10 @@ End Class TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=16)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=16))) - End Sub + End Function - Public Sub GetStartPoint2() + Public Async Function TestGetStartPoint2() As Task Dim code = Imports System @@ -52,7 +53,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -73,16 +74,16 @@ End Class TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=20)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=20))) - End Sub + End Function - Public Sub GetStartPoint3() + Public Async Function TestGetStartPoint3() As Task Dim code = <$$Assembly: CLSCompliant(True)> - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -103,14 +104,14 @@ End Class TextPoint(line:=1, lineOffset:=2, absoluteOffset:=2, lineLength:=30)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=2, absoluteOffset:=2, lineLength:=30))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint1() + Public Async Function TestGetEndPoint1() As Task Dim code = Imports System @@ -119,7 +120,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -140,10 +141,10 @@ End Class TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=16)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=16))) - End Sub + End Function - Public Sub GetEndPoint2() + Public Async Function TestGetEndPoint2() As Task Dim code = Imports System @@ -152,7 +153,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -173,16 +174,16 @@ End Class TextPoint(line:=3, lineOffset:=20, absoluteOffset:=36, lineLength:=20)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=20, absoluteOffset:=36, lineLength:=20))) - End Sub + End Function - Public Sub GetEndPoint3() + Public Async Function TestGetEndPoint3() As Task Dim code = <$$Assembly: CLSCompliant(True)> - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -203,14 +204,14 @@ End Class TextPoint(line:=1, lineOffset:=30, absoluteOffset:=30, lineLength:=30)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=30, absoluteOffset:=30, lineLength:=30))) - End Sub + End Function #End Region #Region "AttributeArgument GetStartPoint() tests" - Public Sub GetAttributeArgumentStartPoint1() + Public Async Function TestGetAttributeArgumentStartPoint1() As Task Dim code = Imports System @@ -228,7 +229,7 @@ Class FooAttribute End Class - TestAttributeArgumentStartPoint(code, 1, + Await TestAttributeArgumentStartPoint(code, 1, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -249,10 +250,10 @@ End Class TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=25)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=25))) - End Sub + End Function - Public Sub GetAttributeArgumentStartPoint2() + Public Async Function TestGetAttributeArgumentStartPoint2() As Task Dim code = Imports System @@ -270,7 +271,7 @@ Class FooAttribute End Class - TestAttributeArgumentStartPoint(code, 2, + Await TestAttributeArgumentStartPoint(code, 2, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -291,10 +292,10 @@ End Class TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25))) - End Sub + End Function - Public Sub GetAttributeArgumentStartPoint3() + Public Async Function TestGetAttributeArgumentStartPoint3() As Task Dim code = Imports System @@ -312,7 +313,7 @@ Class FooAttribute End Class - TestAttributeArgumentStartPoint(code, 1, + Await TestAttributeArgumentStartPoint(code, 1, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -333,10 +334,10 @@ End Class TextPoint(line:=3, lineOffset:=15, absoluteOffset:=31, lineLength:=23)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=15, absoluteOffset:=31, lineLength:=23))) - End Sub + End Function - Public Sub GetAttributeArgumentStartPoint4() + Public Async Function TestGetAttributeArgumentStartPoint4() As Task Dim code = Imports System @@ -354,7 +355,7 @@ Class FooAttribute End Class - TestAttributeArgumentStartPoint(code, 2, + Await TestAttributeArgumentStartPoint(code, 2, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -375,14 +376,14 @@ End Class TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=23)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=23))) - End Sub + End Function #End Region #Region "AttributeArgument GetEndPoint() tests" - Public Sub GetAttributeArgumentEndPoint1() + Public Async Function TestGetAttributeArgumentEndPoint1() As Task Dim code = Imports System @@ -400,7 +401,7 @@ Class FooAttribute End Class - TestAttributeArgumentEndPoint(code, 1, + Await TestAttributeArgumentEndPoint(code, 1, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -421,10 +422,10 @@ End Class TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25))) - End Sub + End Function - Public Sub GetAttributeArgumentEndPoint2() + Public Async Function TestGetAttributeArgumentEndPoint2() As Task Dim code = Imports System @@ -442,7 +443,7 @@ Class FooAttribute End Class - TestAttributeArgumentEndPoint(code, 2, + Await TestAttributeArgumentEndPoint(code, 2, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -463,10 +464,10 @@ End Class TextPoint(line:=3, lineOffset:=18, absoluteOffset:=34, lineLength:=25)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=18, absoluteOffset:=34, lineLength:=25))) - End Sub + End Function - Public Sub GetAttributeArgumentEndPoint3() + Public Async Function TestGetAttributeArgumentEndPoint3() As Task Dim code = Imports System @@ -484,7 +485,7 @@ Class FooAttribute End Class - TestAttributeArgumentEndPoint(code, 1, + Await TestAttributeArgumentEndPoint(code, 1, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -505,10 +506,10 @@ End Class TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=23)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=23))) - End Sub + End Function - Public Sub GetAttributeArgumentEndPoint4() + Public Async Function TestGetAttributeArgumentEndPoint4() As Task Dim code = Imports System @@ -526,7 +527,7 @@ Class FooAttribute End Class - TestAttributeArgumentEndPoint(code, 2, + Await TestAttributeArgumentEndPoint(code, 2, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -547,13 +548,13 @@ End Class TextPoint(line:=3, lineOffset:=22, absoluteOffset:=38, lineLength:=23)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=22, absoluteOffset:=38, lineLength:=23))) - End Sub + End Function #End Region #Region "FullName tests" - Public Sub GetFullName1() + Public Async Function TestGetFullName1() As Task Dim code = Imports System @@ -563,11 +564,11 @@ Class C End Class - TestFullName(code, "System.SerializableAttribute") - End Sub + Await TestFullName(code, "System.SerializableAttribute") + End Function - Public Sub GetFullName2() + Public Async Function TestGetFullName2() As Task Dim code = <$$System.Serializable> @@ -575,14 +576,14 @@ Class C End Class - TestFullName(code, "System.SerializableAttribute") - End Sub + Await TestFullName(code, "System.SerializableAttribute") + End Function #End Region #Region "Parent tests" - Public Sub GetParent1() + Public Async Function TestGetParent1() As Task Dim code = Imports System @@ -592,11 +593,11 @@ Class C End Class - TestParent(code, IsElement("C", kind:=EnvDTE.vsCMElement.vsCMElementClass)) - End Sub + Await TestParent(code, IsElement("C", kind:=EnvDTE.vsCMElement.vsCMElementClass)) + End Function - Public Sub GetParent2() + Public Async Function TestGetParent2() As Task Dim code = Imports System @@ -606,14 +607,14 @@ Class C End Class - TestParent(code, IsElement("C", kind:=EnvDTE.vsCMElement.vsCMElementClass)) - End Sub + Await TestParent(code, IsElement("C", kind:=EnvDTE.vsCMElement.vsCMElementClass)) + End Function #End Region #Region "Attribute argument tests" - Public Sub GetArguments1() + Public Async Function TestGetArguments1() As Task Dim code = Imports System @@ -623,11 +624,11 @@ Class C End Class - TestAttributeArguments(code, NoElements) - End Sub + Await TestAttributeArguments(code, NoElements) + End Function - Public Sub GetArguments2() + Public Async Function TestGetArguments2() As Task Dim code = Imports System @@ -637,11 +638,11 @@ Class C End Class - TestAttributeArguments(code, NoElements) - End Sub + Await TestAttributeArguments(code, NoElements) + End Function - Public Sub GetArguments3() + Public Async Function TestGetArguments3() As Task Dim code = Imports System @@ -651,11 +652,11 @@ Class C End Class - TestAttributeArguments(code, IsAttributeArgument(value:="True")) - End Sub + Await TestAttributeArguments(code, IsAttributeArgument(value:="True")) + End Function - Public Sub GetArguments4() + Public Async Function TestGetArguments4() As Task Dim code = Imports System @@ -666,12 +667,12 @@ Class CAttribute End Class - TestAttributeArguments(code, IsAttributeArgument(value:="AttributeTargets.All"), IsAttributeArgument(name:="AllowMultiple", value:="False")) + Await TestAttributeArguments(code, IsAttributeArgument(value:="AttributeTargets.All"), IsAttributeArgument(name:="AllowMultiple", value:="False")) - End Sub + End Function - Public Sub GetArguments5_Omitted() + Public Async Function TestGetArguments5_Omitted() As Task Dim code = <$$Foo(, Baz:=True)> @@ -693,15 +694,15 @@ Class FooAttribute End Class - TestAttributeArguments(code, IsAttributeArgument(name:=""), IsAttributeArgument(name:="Baz", value:="True")) + Await TestAttributeArguments(code, IsAttributeArgument(name:=""), IsAttributeArgument(name:="Baz", value:="True")) - End Sub + End Function #End Region #Region "Target tests" - Public Sub GetTarget1() + Public Async Function TestGetTarget1() As Task Dim code = Imports System @@ -709,13 +710,13 @@ Imports System <Assembly: CLSCompliant$$(False)> - TestTarget(code, "Assembly") - End Sub + Await TestTarget(code, "Assembly") + End Function #End Region #Region "Value tests" - Public Sub GetValue1() + Public Async Function TestGetValue1() As Task Dim code = Imports System @@ -725,11 +726,11 @@ Class C End Class - TestValue(code, "") - End Sub + Await TestValue(code, "") + End Function - Public Sub GetValue2() + Public Async Function TestGetValue2() As Task Dim code = Imports System @@ -739,11 +740,11 @@ Class C End Class - TestValue(code, "") - End Sub + Await TestValue(code, "") + End Function - Public Sub GetValue3() + Public Async Function TestGetValue3() As Task Dim code = Imports System @@ -753,12 +754,12 @@ Class C End Class - TestValue(code, "False") + Await TestValue(code, "False") - End Sub + End Function - Public Sub GetValue4() + Public Async Function TestGetValue4() As Task Dim code = Imports System @@ -769,13 +770,13 @@ Class CAttribute End Class - TestValue(code, "AttributeTargets.All, AllowMultiple = False") - End Sub + Await TestValue(code, "AttributeTargets.All, AllowMultiple = False") + End Function #End Region #Region "AddAttributeArgument tests" - Public Sub AddAttributeArgument1() + Public Async Function TestAddAttributeArgument1() As Task Dim code = Imports System @@ -794,12 +795,12 @@ Class C End Class - TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Value = "True"}) + Await TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Value = "True"}) - End Sub + End Function - Public Sub AddAttributeArgument2() + Public Async Function TestAddAttributeArgument2() As Task Dim code = Imports System @@ -818,12 +819,12 @@ Class C End Class - TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Value = "True"}) + Await TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Value = "True"}) - End Sub + End Function - Public Sub TestAddArgument3() + Public Async Function TestAddArgument3() As Task Dim code = Imports System @@ -844,14 +845,14 @@ Class CAttribute End Class - TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Name = "AllowMultiple", .Value = "False", .Position = 1}) + Await TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Name = "AllowMultiple", .Value = "False", .Position = 1}) - End Sub + End Function #End Region #Region "Delete tests" - Public Sub Delete1() + Public Async Function TestDelete1() As Task Dim code = @@ -865,12 +866,12 @@ Class C End Class ]]> - TestDelete(code, expected) + Await TestDelete(code, expected) - End Sub + End Function - Public Sub Delete2() + Public Async Function TestDelete2() As Task Dim code = @@ -885,11 +886,11 @@ Class C End Class ]]> - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function - Public Sub Delete3() + Public Async Function TestDelete3() As Task Dim code = @@ -905,11 +906,11 @@ Class C End Class ]]> - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function - Public Sub Delete4() + Public Async Function TestDelete4() As Task Dim code = @@ -919,11 +920,11 @@ End Class - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function - Public Sub Delete5() + Public Async Function TestDelete5() As Task Dim code = @@ -934,11 +935,11 @@ End Class ]]> - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function - Public Sub Delete6() + Public Async Function TestDelete6() As Task Dim code = @@ -950,11 +951,11 @@ End Class ]]> - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function - Public Sub Delete7() + Public Async Function TestDelete7() As Task Dim code = @@ -974,11 +975,11 @@ Class C End Class ]]> - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function - Public Sub Delete8() + Public Async Function TestDelete8() As Task Dim code = ' Comment comment comment @@ -992,15 +993,15 @@ Class C End Class ]]> - TestDelete(code, expected) - End Sub + Await TestDelete(code, expected) + End Function #End Region #Region "Delete attribute argument tests" - Public Sub DeleteAttributeArgument1() + Public Async Function TestDeleteAttributeArgument1() As Task Dim code = @@ -1015,11 +1016,11 @@ Class C End Class ]]> - TestDeleteAttributeArgument(code, expected, 1) - End Sub + Await TestDeleteAttributeArgument(code, expected, 1) + End Function - Public Sub DeleteAttributeArgument2() + Public Async Function TestDeleteAttributeArgument2() As Task Dim code = @@ -1036,11 +1037,11 @@ Class CAttribute End Class ]]> - TestDeleteAttributeArgument(code, expected, 1) - End Sub + Await TestDeleteAttributeArgument(code, expected, 1) + End Function - Public Sub DeleteAttributeArgument3() + Public Async Function TestDeleteAttributeArgument3() As Task Dim code = @@ -1057,14 +1058,14 @@ Class CAttribute End Class ]]> - TestDeleteAttributeArgument(code, expected, 2) - End Sub + Await TestDeleteAttributeArgument(code, expected, 2) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = @@ -1079,13 +1080,13 @@ Class C End Class ]]> - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region #Region "Set Target tests" - Public Sub SetTarget1() + Public Async Function TestSetTarget1() As Task Dim code = Imports System @@ -1100,11 +1101,11 @@ Imports System <Module: CLSCompliant(False)> - TestSetTarget(code, expected, "Module") - End Sub + Await TestSetTarget(code, expected, "Module") + End Function - Public Sub SetTarget2() + Public Async Function TestSetTarget2() As Task Dim code = Imports System @@ -1123,11 +1124,11 @@ Class C End Class - TestSetTarget(code, expected, "Assembly") - End Sub + Await TestSetTarget(code, expected, "Assembly") + End Function - Public Sub SetTarget3() + Public Async Function TestSetTarget3() As Task Dim code = Imports System @@ -1142,13 +1143,13 @@ Imports System <CLSCompliant(False)> - TestSetTarget(code, expected, "") - End Sub + Await TestSetTarget(code, expected, "") + End Function #End Region #Region "Set Value tests" - Public Sub SetValue1() + Public Async Function TestSetValue1() As Task Dim code = Imports System @@ -1163,11 +1164,11 @@ Imports System <Assembly: CLSCompliant(True)> - TestSetValue(code, expected, "True") - End Sub + Await TestSetValue(code, expected, "True") + End Function - Public Sub SetValue2() + Public Async Function TestSetValue2() As Task Dim code = Imports System @@ -1182,11 +1183,11 @@ Imports System <Assembly: CLSCompliant(True)> - TestSetValue(code, expected, "True") - End Sub + Await TestSetValue(code, expected, "True") + End Function - Public Sub SetValue3() + Public Async Function TestSetValue3() As Task Dim code = Imports System @@ -1201,11 +1202,11 @@ Imports System <Assembly: CLSCompliant(True)> - TestSetValue(code, expected, "True") - End Sub + Await TestSetValue(code, expected, "True") + End Function - Public Sub SetValue4() + Public Async Function TestSetValue4() As Task Dim code = Imports System @@ -1220,8 +1221,8 @@ Imports System <Assembly: CLSCompliant()> - TestSetValue(code, expected, "") - End Sub + Await TestSetValue(code, expected, "") + End Function #End Region Protected Overrides ReadOnly Property LanguageName As String diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeClassTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeClassTests.vb index ca40afaf1b20a3f9d3403778ef6fff7362f43e56..ee906a0aa4af49146595ab935ad37bf0f50065f0 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeClassTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeClassTests.vb @@ -1,6 +1,7 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. Imports System.Runtime.InteropServices +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.CodeModel.Extenders Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.CodeModel.Interop @@ -13,37 +14,37 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "Access tests" - Public Sub Access1() + Public Async Function TestAccess1() As Task Dim code = Class $$C : End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access2() + Public Async Function TestAccess2() As Task Dim code = Friend Class $$C : End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access3() + Public Async Function TestAccess3() As Task Dim code = Public Class $$C : End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access4() + Public Async Function TestAccess4() As Task Dim code = Class C @@ -52,11 +53,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access5() + Public Async Function TestAccess5() As Task Dim code = Class C @@ -64,11 +65,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access6() + Public Async Function TestAccess6() As Task Dim code = Class C @@ -76,11 +77,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) + End Function - Public Sub Access7() + Public Async Function TestAccess7() As Task Dim code = Class C @@ -88,11 +89,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub Access8() + Public Async Function TestAccess8() As Task Dim code = Class C @@ -100,11 +101,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access9() + Public Async Function TestAccess9() As Task Dim code = Class C @@ -112,15 +113,15 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function #End Region #Region "AddBase tests" - Public Sub AddBase1() + Public Async Function TestAddBase1() As Task Dim code = Class C$$ @@ -139,11 +140,11 @@ End Class Class B End Class - TestAddBase(code, "B", Nothing, expected) - End Sub + Await TestAddBase(code, "B", Nothing, expected) + End Function - Public Sub AddBase2() + Public Async Function TestAddBase2() As Task Dim code = Class C$$ @@ -151,11 +152,11 @@ Class C$$ End Class - TestAddBaseThrows(Of COMException)(code, "A", Nothing) - End Sub + Await TestAddBaseThrows(Of COMException)(code, "A", Nothing) + End Function - Public Sub AddBase3() + Public Async Function TestAddBase3() As Task Dim code = Class $$C @@ -166,48 +167,48 @@ Class $$C Class C Inherits B - TestAddBase(code, "B", Nothing, expected) - End Sub + Await TestAddBase(code, "B", Nothing, expected) + End Function #End Region #Region "ClassKind tests" - Public Sub ClassKind_MainClass() + Public Async Function TestClassKind_MainClass() As Task Dim code = Class $$C End Class - TestClassKind(code, EnvDTE80.vsCMClassKind.vsCMClassKindMainClass) - End Sub + Await TestClassKind(code, EnvDTE80.vsCMClassKind.vsCMClassKindMainClass) + End Function - Public Sub ClassKind_Module() + Public Async Function TestClassKind_Module() As Task Dim code = Module $$M End Module - TestClassKind(code, EnvDTE80.vsCMClassKind.vsCMClassKindModule) - End Sub + Await TestClassKind(code, EnvDTE80.vsCMClassKind.vsCMClassKindModule) + End Function - Public Sub ClassKind_PartialClass1() + Public Async Function TestClassKind_PartialClass1() As Task Dim code = Partial Class $$C End Class - TestClassKind(code, EnvDTE80.vsCMClassKind.vsCMClassKindPartialClass) - End Sub + Await TestClassKind(code, EnvDTE80.vsCMClassKind.vsCMClassKindPartialClass) + End Function - Public Sub ClassKind_PartialClass2() + Public Async Function TestClassKind_PartialClass2() As Task Dim code = Class $$C @@ -217,15 +218,15 @@ Partial Class C End Class - TestClassKind(code, EnvDTE80.vsCMClassKind.vsCMClassKindPartialClass) - End Sub + Await TestClassKind(code, EnvDTE80.vsCMClassKind.vsCMClassKindPartialClass) + End Function #End Region #Region "Comment tests" - Public Sub Comment1() + Public Async Function TestComment1() As Task Dim code = ' Foo @@ -235,11 +236,11 @@ End Class Dim result = " Foo" - TestComment(code, result) - End Sub + Await TestComment(code, result) + End Function - Public Sub Comment2() + Public Async Function TestComment2() As Task Dim code = ' Foo @@ -251,11 +252,11 @@ End Class Dim result = " Foo" & vbCrLf & " Bar" - TestComment(code, result) - End Sub + Await TestComment(code, result) + End Function - Public Sub Comment3() + Public Async Function TestComment3() As Task Dim code = ' Foo @@ -267,11 +268,11 @@ End Class Dim result = " Bar" - TestComment(code, result) - End Sub + Await TestComment(code, result) + End Function - Public Sub Comment4() + Public Async Function TestComment4() As Task Dim code = Class B @@ -284,11 +285,11 @@ End Class Dim result = " Bar" - TestComment(code, result) - End Sub + Await TestComment(code, result) + End Function - Public Sub Comment5() + Public Async Function TestComment5() As Task Dim code = ' Foo @@ -299,15 +300,15 @@ End Class Dim result = "" - TestComment(code, result) - End Sub + Await TestComment(code, result) + End Function #End Region #Region "DocComment tests" - Public Sub DocComment1() + Public Async Function TestDocComment1() As Task Dim code = ''' <summary> @@ -324,11 +325,11 @@ End Class " " & vbCrLf & " " - TestDocComment(code, result) - End Sub + Await TestDocComment(code, result) + End Function - Public Sub DocComment2() + Public Async Function TestDocComment2() As Task Dim code = ''' <summary> @@ -343,11 +344,11 @@ End Class " Hello World" & vbCrLf & " " - TestDocComment(code, result) - End Sub + Await TestDocComment(code, result) + End Function - Public Sub DocComment3() + Public Async Function TestDocComment3() As Task Dim code = ''' <summary> @@ -362,11 +363,11 @@ End Class Dim result = " " - TestDocComment(code, result) - End Sub + Await TestDocComment(code, result) + End Function - Public Sub DocComment4() + Public Async Function TestDocComment4() As Task Dim code = Namespace N @@ -385,48 +386,48 @@ End Namespace " " & vbCrLf & " " - TestDocComment(code, result) - End Sub + Await TestDocComment(code, result) + End Function #End Region #Region "InheritanceKind tests" - Public Sub InheritanceKind_None() + Public Async Function TestInheritanceKind_None() As Task Dim code = Class $$C End Class - TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNone) - End Sub + Await TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNone) + End Function - Public Sub InheritanceKind_Abstract() + Public Async Function TestInheritanceKind_Abstract() As Task Dim code = MustInherit Class $$C End Class - TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract) - End Sub + Await TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract) + End Function - Public Sub InheritanceKind_Sealed() + Public Async Function TestInheritanceKind_Sealed() As Task Dim code = NotInheritable Class $$C End Class - TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindSealed) - End Sub + Await TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindSealed) + End Function - Public Sub InheritanceKind_New() + Public Async Function TestInheritanceKind_New() As Task Dim code = Class Outer @@ -440,11 +441,11 @@ Class Derived End Class - TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) - End Sub + Await TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) + End Function - Public Sub InheritanceKind_AbstractAndNew() + Public Async Function TestInheritanceKind_AbstractAndNew() As Task Dim code = Public Class Outer @@ -462,11 +463,11 @@ Public Class Derived End Class - TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) - End Sub + Await TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) + End Function - Public Sub InheritanceKind_AbstractAndNew_Partial1() + Public Async Function TestInheritanceKind_AbstractAndNew_Partial1() As Task Dim code = Public Class Outer @@ -491,11 +492,11 @@ Partial Public Class Derived End Class - TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) - End Sub + Await TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) + End Function - Public Sub InheritanceKind_AbstractAndNew_Partial2() + Public Async Function TestInheritanceKind_AbstractAndNew_Partial2() As Task Dim code = Public Class Outer @@ -520,11 +521,11 @@ Partial Public Class Derived End Class - TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) - End Sub + Await TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) + End Function - Public Sub InheritanceKind_AbstractAndNew_Partial3() + Public Async Function TestInheritanceKind_AbstractAndNew_Partial3() As Task Dim code = Public Class Outer @@ -549,11 +550,11 @@ Partial Public Class Derived End Class - TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) - End Sub + Await TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) + End Function - Public Sub InheritanceKind_AbstractAndNew_Partial4() + Public Async Function TestInheritanceKind_AbstractAndNew_Partial4() As Task Dim code = Public Class Outer @@ -578,37 +579,37 @@ Partial Public Class Derived End Class - TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) - End Sub + Await TestInheritanceKind(code, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) + End Function #End Region #Region "IsAbstract tests" - Public Sub IsAbstract1() + Public Async Function TestIsAbstract1() As Task Dim code = Class $$C End Class - TestIsAbstract(code, False) - End Sub + Await TestIsAbstract(code, False) + End Function - Public Sub IsAbstract2() + Public Async Function TestIsAbstract2() As Task Dim code = MustInherit Class $$C End Class - TestIsAbstract(code, True) - End Sub + Await TestIsAbstract(code, True) + End Function - Public Sub IsAbstract3() + Public Async Function TestIsAbstract3() As Task Dim code = Partial MustInherit Class $$C @@ -618,11 +619,11 @@ Partial Class C End Class - TestIsAbstract(code, True) - End Sub + Await TestIsAbstract(code, True) + End Function - Public Sub IsAbstract4() + Public Async Function TestIsAbstract4() As Task Dim code = Partial Class $$C @@ -632,88 +633,88 @@ Partial MustInherit Class C End Class - TestIsAbstract(code, True) - End Sub + Await TestIsAbstract(code, True) + End Function #End Region #Region "IsShared tests" - Public Sub IsShared1() + Public Async Function TestIsShared1() As Task Dim code = Class $$C End Class - TestIsShared(code, False) - End Sub + Await TestIsShared(code, False) + End Function - Public Sub IsShared2() + Public Async Function TestIsShared2() As Task Dim code = Module $$M End Module - TestIsShared(code, True) - End Sub + Await TestIsShared(code, True) + End Function #End Region #Region "Kind tests" - Public Sub Kind1() + Public Async Function TestKind1() As Task Dim code = Class $$C End Class - TestKind(code, EnvDTE.vsCMElement.vsCMElementClass) - End Sub + Await TestKind(code, EnvDTE.vsCMElement.vsCMElementClass) + End Function - Public Sub Kind2() + Public Async Function TestKind2() As Task Dim code = Module $$M End Module - TestKind(code, EnvDTE.vsCMElement.vsCMElementModule) - End Sub + Await TestKind(code, EnvDTE.vsCMElement.vsCMElementModule) + End Function #End Region #Region "Parts tests" - Public Sub Parts1() + Public Async Function TestParts1() As Task Dim code = Class $$C End Class - TestParts(code, 1) - End Sub + Await TestParts(code, 1) + End Function - Public Sub Parts2() + Public Async Function TestParts2() As Task Dim code = Partial Class $$C End Class - TestParts(code, 1) - End Sub + Await TestParts(code, 1) + End Function - Public Sub Parts3() + Public Async Function TestParts3() As Task Dim code = Partial Class $$C @@ -723,14 +724,14 @@ Partial Class C End Class - TestParts(code, 2) - End Sub + Await TestParts(code, 2) + End Function #End Region #Region "AddFunction tests" - Public Sub AddFunction1() + Public Async Function TestAddFunction1() As Task Dim code = Class $$C @@ -746,11 +747,11 @@ Class C End Class - TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Kind = EnvDTE.vsCMFunction.vsCMFunctionSub}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Kind = EnvDTE.vsCMFunction.vsCMFunctionSub}) + End Function - Public Sub AddFunction2() + Public Async Function TestAddFunction2() As Task Dim code = Class $$C @@ -766,11 +767,11 @@ Class C End Class - TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Access = EnvDTE.vsCMAccess.vsCMAccessPrivate, .Type = "Integer"}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "Foo", .Access = EnvDTE.vsCMAccess.vsCMAccessPrivate, .Type = "Integer"}) + End Function - Public Sub AddFunction_ConstructorFailure() + Public Async Function TestAddFunction_ConstructorFailure() As Task ' Note: Adding a constructor by specifying vsCMFunctionConstructor is not supported by VB code model. Dim code = @@ -787,14 +788,14 @@ Module M End Module - Assert.Throws(Of ArgumentException)( - Sub() - TestAddFunction(code, expected, New FunctionData With {.Kind = EnvDTE.vsCMFunction.vsCMFunctionConstructor}) - End Sub) - End Sub + Await Assert.ThrowsAsync(Of ArgumentException)( + Async Function() + Await TestAddFunction(code, expected, New FunctionData With {.Kind = EnvDTE.vsCMFunction.vsCMFunctionConstructor}) + End Function) + End Function - Public Sub AddFunction_Constructor1() + Public Async Function TestAddFunction_Constructor1() As Task Dim code = Module $$M @@ -810,11 +811,11 @@ Module M End Module - TestAddFunction(code, expected, New FunctionData With {.Name = "New", .Kind = EnvDTE.vsCMFunction.vsCMFunctionSub}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "New", .Kind = EnvDTE.vsCMFunction.vsCMFunctionSub}) + End Function - Public Sub AddFunction_Constructor2() + Public Async Function TestAddFunction_Constructor2() As Task Dim code = Class $$C @@ -830,11 +831,11 @@ Class C End Class - TestAddFunction(code, expected, New FunctionData With {.Name = "New", .Kind = EnvDTE.vsCMFunction.vsCMFunctionSub}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "New", .Kind = EnvDTE.vsCMFunction.vsCMFunctionSub}) + End Function - Public Sub AddFunction_Destructor() + Public Async Function TestAddFunction_Destructor() As Task Dim code = Class $$C @@ -847,15 +848,15 @@ Class C End Class - Assert.Throws(Of ArgumentException)( - Sub() - TestAddFunction(code, expected, New FunctionData With {.Name = "C", .Kind = EnvDTE.vsCMFunction.vsCMFunctionDestructor}) - End Sub) - End Sub + Await Assert.ThrowsAsync(Of ArgumentException)( + Async Function() + Await TestAddFunction(code, expected, New FunctionData With {.Name = "C", .Kind = EnvDTE.vsCMFunction.vsCMFunctionDestructor}) + End Function) + End Function - Public Sub AddFunction_AfterIncompleteMember() + Public Async Function TestAddFunction_AfterIncompleteMember() As Task Dim code = Class $$C @@ -879,15 +880,15 @@ Private Sub M2() End Class - TestAddFunction(code, expected, New FunctionData With {.Name = "M2", .Type = "void", .Position = -1, .Access = EnvDTE.vsCMAccess.vsCMAccessPrivate}) - End Sub + Await TestAddFunction(code, expected, New FunctionData With {.Name = "M2", .Type = "void", .Position = -1, .Access = EnvDTE.vsCMAccess.vsCMAccessPrivate}) + End Function #End Region #Region "AddProperty tests" - Public Sub AddProperty1() + Public Async Function TestAddProperty1() As Task Dim code = Class $$C @@ -907,11 +908,11 @@ Class C End Class - TestAddProperty(code, expected, New PropertyData With {.GetterName = "Name", .PutterName = "Name", .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefString}) - End Sub + Await TestAddProperty(code, expected, New PropertyData With {.GetterName = "Name", .PutterName = "Name", .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefString}) + End Function - Public Sub AddProperty2() + Public Async Function TestAddProperty2() As Task Dim code = Class $$C @@ -929,11 +930,11 @@ Class C End Class - TestAddProperty(code, expected, New PropertyData With {.GetterName = "Name", .PutterName = Nothing, .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefString}) - End Sub + Await TestAddProperty(code, expected, New PropertyData With {.GetterName = "Name", .PutterName = Nothing, .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefString}) + End Function - Public Sub AddProperty3() + Public Async Function TestAddProperty3() As Task Dim code = Class $$C @@ -950,15 +951,15 @@ Class C End Class - TestAddProperty(code, expected, New PropertyData With {.GetterName = Nothing, .PutterName = "Name", .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefString}) - End Sub + Await TestAddProperty(code, expected, New PropertyData With {.GetterName = Nothing, .PutterName = "Name", .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefString}) + End Function #End Region #Region "AddImplementedInterface tests" - Public Sub AddImplementedInterface1() + Public Async Function TestAddImplementedInterface1() As Task Dim code = Class $$C @@ -972,11 +973,11 @@ Class C End Class - TestAddImplementedInterface(code, "I", Nothing, expected) - End Sub + Await TestAddImplementedInterface(code, "I", Nothing, expected) + End Function - Public Sub AddImplementedInterface2() + Public Async Function TestAddImplementedInterface2() As Task Dim code = Class $$C @@ -992,11 +993,11 @@ Class C End Class - TestAddImplementedInterface(code, "J", Nothing, expected) - End Sub + Await TestAddImplementedInterface(code, "J", Nothing, expected) + End Function - Public Sub AddImplementedInterface3() + Public Async Function TestAddImplementedInterface3() As Task Dim code = Class $$C @@ -1012,19 +1013,19 @@ Class C End Class - TestAddImplementedInterface(code, "J", -1, expected) - End Sub + Await TestAddImplementedInterface(code, "J", -1, expected) + End Function - Public Sub AddImplementedInterface4() + Public Async Function TestAddImplementedInterface4() As Task Dim code = Class $$C End Class - TestAddImplementedInterfaceThrows(Of ArgumentException)(code, "I", 1) - End Sub + Await TestAddImplementedInterfaceThrows(Of ArgumentException)(code, "I", 1) + End Function #End Region @@ -1034,7 +1035,7 @@ End Class ' to ensure that we are backward compatible with the existing behavior. - Public Sub AddVariable1() + Public Async Function TestAddVariable1() As Task Dim code = Class $$C @@ -1048,11 +1049,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) + End Function - Public Sub AddVariable2() + Public Async Function TestAddVariable2() As Task Dim code = Class $$C : End Class @@ -1065,11 +1066,11 @@ Class C : End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) + End Function - Public Sub AddVariable3() + Public Async Function TestAddVariable3() As Task Dim code = Class $$C @@ -1081,11 +1082,11 @@ Class C Dim i As Integer - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) + End Function - Public Sub AddVariable4() + Public Async Function TestAddVariable4() As Task Dim code = Class $$C @@ -1100,11 +1101,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) + End Function - Public Sub AddVariable5() + Public Async Function TestAddVariable5() As Task Dim code = Class $$C @@ -1121,11 +1122,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) + End Function - Public Sub AddVariable6() + Public Async Function TestAddVariable6() As Task Dim code = Class $$C @@ -1143,11 +1144,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32"}) + End Function - Public Sub AddVariable7() + Public Async Function TestAddVariable7() As Task Dim code = Class $$C @@ -1166,11 +1167,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "Foo"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "Foo"}) + End Function - Public Sub AddVariable8() + Public Async Function TestAddVariable8() As Task Dim code = Class $$C @@ -1187,11 +1188,11 @@ Class C Dim i As Integer - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "Foo"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "Foo"}) + End Function - Public Sub AddVariable9() + Public Async Function TestAddVariable9() As Task Dim code = Class $$C @@ -1212,11 +1213,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) + End Function - Public Sub AddVariable10() + Public Async Function TestAddVariable10() As Task Dim code = Class $$C @@ -1238,11 +1239,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) + End Function - Public Sub AddVariable11() + Public Async Function TestAddVariable11() As Task Dim code = Class $$C @@ -1264,11 +1265,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) + End Function - Public Sub AddVariable12() + Public Async Function TestAddVariable12() As Task Dim code = Class $$C @@ -1290,11 +1291,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) + End Function - Public Sub AddVariable13() + Public Async Function TestAddVariable13() As Task Dim code = Class $$C @@ -1316,11 +1317,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "y"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "y"}) + End Function - Public Sub AddVariable14() + Public Async Function TestAddVariable14() As Task Dim code = Class $$C @@ -1339,11 +1340,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = 0}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = 0}) + End Function - Public Sub AddVariable15() + Public Async Function TestAddVariable15() As Task Dim code = Class $$C @@ -1362,11 +1363,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = -1}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = -1}) + End Function - Public Sub AddVariable16() + Public Async Function TestAddVariable16() As Task Dim code = Class $$C @@ -1384,11 +1385,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) + End Function - Public Sub AddVariable17() + Public Async Function TestAddVariable17() As Task Dim code = Class $$C @@ -1406,11 +1407,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "x"}) + End Function - Public Sub AddVariable18() + Public Async Function TestAddVariable18() As Task Dim code = Class $$C @@ -1428,11 +1429,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "y"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Position = "y"}) + End Function - Public Sub AddVariable19() + Public Async Function TestAddVariable19() As Task Dim code = Class $$C @@ -1446,11 +1447,11 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessPublic}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessPublic}) + End Function - Public Sub AddVariable20() + Public Async Function TestAddVariable20() As Task Dim code = Class $$C @@ -1465,12 +1466,12 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessPrivate}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessPrivate}) + End Function - Public Sub AddVariable21() + Public Async Function TestAddVariable21() As Task Dim code = Class $$C @@ -1485,12 +1486,12 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessProject}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessProject}) + End Function - Public Sub AddVariable22() + Public Async Function TestAddVariable22() As Task Dim code = Class $$C @@ -1505,12 +1506,12 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected}) + End Function - Public Sub AddVariable23() + Public Async Function TestAddVariable23() As Task Dim code = Class $$C @@ -1525,12 +1526,12 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessProtected}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "i", .Type = "System.Int32", .Access = EnvDTE.vsCMAccess.vsCMAccessProtected}) + End Function - Public Sub AddVariableAfterComment() + Public Async Function TestAddVariableAfterComment() As Task Dim code = Class $$C @@ -1546,15 +1547,15 @@ Class C End Class - TestAddVariable(code, expected, New VariableData With {.Name = "j", .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefInt, .Position = "i"}) - End Sub + Await TestAddVariable(code, expected, New VariableData With {.Name = "j", .Type = EnvDTE.vsCMTypeRef.vsCMTypeRefInt, .Position = "i"}) + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = Imports System @@ -1571,11 +1572,11 @@ Imports System Class C End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = Imports System @@ -1594,12 +1595,12 @@ Imports System Class C End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment1() + Public Async Function TestAddAttribute_BelowDocComment1() As Task Dim code = Imports System @@ -1618,12 +1619,12 @@ Imports System Class C End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True"}) + End Function - Public Sub AddAttribute_BelowDocComment2() + Public Async Function TestAddAttribute_BelowDocComment2() As Task Dim code = Imports System @@ -1644,12 +1645,12 @@ Imports System Class C End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True"}) + End Function - Public Sub AddAttribute_BelowDocComment3() + Public Async Function TestAddAttribute_BelowDocComment3() As Task Dim code = Imports System @@ -1670,15 +1671,15 @@ Imports System Class C End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True", .Position = 1}) + End Function #End Region #Region "RemoveBase tests" - Public Sub RemoveBase1() + Public Async Function TestRemoveBase1() As Task Dim code = Class $$C @@ -1691,22 +1692,22 @@ End Class Class C End Class - TestRemoveBase(code, "B", expected) - End Sub + Await TestRemoveBase(code, "B", expected) + End Function - Public Sub RemoveBase2() + Public Async Function TestRemoveBase2() As Task Dim code = Class $$C End Class - TestRemoveBaseThrows(Of COMException)(code, "B") - End Sub + Await TestRemoveBaseThrows(Of COMException)(code, "B") + End Function - Public Sub RemoveBase3() + Public Async Function TestRemoveBase3() As Task Dim code = Class $$C @@ -1720,11 +1721,11 @@ Class C Inherits A End Class - TestRemoveBase(code, "B", expected) - End Sub + Await TestRemoveBase(code, "B", expected) + End Function - Public Sub RemoveBase4() + Public Async Function TestRemoveBase4() As Task Dim code = Class $$C @@ -1738,11 +1739,11 @@ Class C Inherits B End Class - TestRemoveBase(code, "A", expected) - End Sub + Await TestRemoveBase(code, "A", expected) + End Function - Public Sub RemoveBase5() + Public Async Function TestRemoveBase5() As Task Dim code = Class $$C @@ -1756,15 +1757,15 @@ Class C Inherits A, D End Class - TestRemoveBase(code, "B", expected) - End Sub + Await TestRemoveBase(code, "B", expected) + End Function #End Region #Region "RemoveImplementedInterface tests" - Public Sub RemoveImplementedInterface1() + Public Async Function TestRemoveImplementedInterface1() As Task Dim code = Class $$C @@ -1777,22 +1778,22 @@ End Class Class C End Class - TestRemoveImplementedInterface(code, "I", expected) - End Sub + Await TestRemoveImplementedInterface(code, "I", expected) + End Function - Public Sub RemoveImplementedInterface2() + Public Async Function TestRemoveImplementedInterface2() As Task Dim code = Class $$C End Class - TestRemoveImplementedInterfaceThrows(Of COMException)(code, "I") - End Sub + Await TestRemoveImplementedInterfaceThrows(Of COMException)(code, "I") + End Function - Public Sub RemoveImplementedInterface3() + Public Async Function TestRemoveImplementedInterface3() As Task Dim code = Class $$C @@ -1806,11 +1807,11 @@ Class C Implements I End Class - TestRemoveImplementedInterface(code, "J", expected) - End Sub + Await TestRemoveImplementedInterface(code, "J", expected) + End Function - Public Sub RemoveImplementedInterface4() + Public Async Function TestRemoveImplementedInterface4() As Task Dim code = Class $$C @@ -1824,11 +1825,11 @@ Class C Implements J End Class - TestRemoveImplementedInterface(code, "I", expected) - End Sub + Await TestRemoveImplementedInterface(code, "I", expected) + End Function - Public Sub RemoveImplementedInterface5() + Public Async Function TestRemoveImplementedInterface5() As Task Dim code = Class $$C @@ -1842,15 +1843,15 @@ Class C Implements I, K End Class - TestRemoveImplementedInterface(code, "J", expected) - End Sub + Await TestRemoveImplementedInterface(code, "J", expected) + End Function #End Region #Region "RemoveMember tests" - Public Sub RemoveMember1() + Public Async Function TestRemoveMember1() As Task Dim code = Class $$C @@ -1864,11 +1865,11 @@ End Class Class C End Class - TestRemoveChild(code, expected, "Foo") - End Sub + Await TestRemoveChild(code, expected, "Foo") + End Function - Public Sub RemoveMember2() + Public Async Function TestRemoveMember2() As Task Dim code = - TestRemoveChild(code, expected, "Foo") - End Sub + Await TestRemoveChild(code, expected, "Foo") + End Function - Public Sub RemoveMember3() + Public Async Function TestRemoveMember3() As Task Dim code = - TestRemoveChild(code, expected, "Foo") - End Sub + Await TestRemoveChild(code, expected, "Foo") + End Function - Public Sub RemoveMember4() + Public Async Function TestRemoveMember4() As Task Dim code = - TestRemoveChild(code, expected, "Foo") - End Sub + Await TestRemoveChild(code, expected, "Foo") + End Function - Public Sub RemoveMember5() + Public Async Function TestRemoveMember5() As Task Dim code = - TestRemoveChild(code, expected, "Foo") - End Sub + Await TestRemoveChild(code, expected, "Foo") + End Function - Public Sub RemoveMember6() + Public Async Function TestRemoveMember6() As Task Dim code = - TestRemoveChild(code, expected, "Foo") - End Sub + Await TestRemoveChild(code, expected, "Foo") + End Function - Public Sub RemoveMember7() + Public Async Function TestRemoveMember7() As Task Dim code = Class $$C @@ -2004,11 +2005,11 @@ Class C End Class - TestRemoveChild(code, expected, "y") - End Sub + Await TestRemoveChild(code, expected, "y") + End Function - Public Sub RemoveMember8() + Public Async Function TestRemoveMember8() As Task Dim code = Class $$C @@ -2034,11 +2035,11 @@ Class C End Class - TestRemoveChild(code, expected, "Foo") - End Sub + Await TestRemoveChild(code, expected, "Foo") + End Function - Public Sub RemoveMember9() + Public Async Function TestRemoveMember9() As Task Dim code = Class $$C @@ -2053,11 +2054,11 @@ Class C End Class - TestRemoveChild(code, expected, "y") - End Sub + Await TestRemoveChild(code, expected, "y") + End Function - Public Sub RemoveMember10() + Public Async Function TestRemoveMember10() As Task Dim code = Class $$C @@ -2072,11 +2073,11 @@ Class C End Class - TestRemoveChild(code, expected, "x") - End Sub + Await TestRemoveChild(code, expected, "x") + End Function - Public Sub RemoveMember11() + Public Async Function TestRemoveMember11() As Task Dim code = Class $$C @@ -2091,11 +2092,11 @@ Class C End Class - TestRemoveChild(code, expected, "x") - End Sub + Await TestRemoveChild(code, expected, "x") + End Function - Public Sub RemoveMember12() + Public Async Function TestRemoveMember12() As Task Dim code = Class $$C @@ -2110,15 +2111,15 @@ Class C End Class - TestRemoveChild(code, expected, "y") - End Sub + Await TestRemoveChild(code, expected, "y") + End Function #End Region #Region "Set Access tests" - Public Sub SetAccess1() + Public Async Function TestSetAccess1() As Task Dim code = Class $$C : End Class @@ -2129,11 +2130,11 @@ Class $$C : End Class Public Class C : End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetAccess2() + Public Async Function TestSetAccess2() As Task Dim code = Public Class $$C : End Class @@ -2144,11 +2145,11 @@ Public Class $$C : End Class Friend Class C : End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub SetAccess3() + Public Async Function TestSetAccess3() As Task Dim code = Protected Friend Class $$C : End Class @@ -2159,11 +2160,11 @@ Protected Friend Class $$C : End Class Public Class C : End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetAccess4() + Public Async Function TestSetAccess4() As Task Dim code = Public Class $$C : End Class @@ -2174,11 +2175,11 @@ Public Class $$C : End Class Public Class C : End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) + End Function - Public Sub SetAccess5() + Public Async Function TestSetAccess5() As Task Dim code = Public Class $$C : End Class @@ -2189,11 +2190,11 @@ Public Class $$C : End Class Class C : End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetAccess6() + Public Async Function TestSetAccess6() As Task Dim code = Public Class $$C : End Class @@ -2204,11 +2205,11 @@ Public Class $$C : End Class Public Class C : End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPrivate, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPrivate, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) + End Function - Public Sub SetAccess7() + Public Async Function TestSetAccess7() As Task Dim code = Class C @@ -2223,15 +2224,15 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function #End Region #Region "Set ClassKind tests" - Public Sub SetClassKind1() + Public Async Function TestSetClassKind1() As Task Dim code = Class $$C @@ -2244,11 +2245,11 @@ Class C End Class - TestSetClassKind(code, expected, EnvDTE80.vsCMClassKind.vsCMClassKindMainClass) - End Sub + Await TestSetClassKind(code, expected, EnvDTE80.vsCMClassKind.vsCMClassKindMainClass) + End Function - Public Sub SetClassKind2() + Public Async Function TestSetClassKind2() As Task Dim code = Class $$C @@ -2261,11 +2262,11 @@ Partial Class C End Class - TestSetClassKind(code, expected, EnvDTE80.vsCMClassKind.vsCMClassKindPartialClass) - End Sub + Await TestSetClassKind(code, expected, EnvDTE80.vsCMClassKind.vsCMClassKindPartialClass) + End Function - Public Sub SetClassKind3() + Public Async Function TestSetClassKind3() As Task Dim code = Partial Class $$C @@ -2278,11 +2279,11 @@ Class C End Class - TestSetClassKind(code, expected, EnvDTE80.vsCMClassKind.vsCMClassKindMainClass) - End Sub + Await TestSetClassKind(code, expected, EnvDTE80.vsCMClassKind.vsCMClassKindMainClass) + End Function - Public Sub SetClassKind4() + Public Async Function TestSetClassKind4() As Task Dim code = Module $$M @@ -2295,15 +2296,15 @@ Module M End Module - TestSetClassKind(code, expected, EnvDTE80.vsCMClassKind.vsCMClassKindMainClass, ThrowsNotImplementedException(Of EnvDTE80.vsCMClassKind)) - End Sub + Await TestSetClassKind(code, expected, EnvDTE80.vsCMClassKind.vsCMClassKindMainClass, ThrowsNotImplementedException(Of EnvDTE80.vsCMClassKind)) + End Function #End Region #Region "Set DataTypeKind tests" - Public Sub SetDataTypeKind1() + Public Async Function TestSetDataTypeKind1() As Task Dim code = Class $$C @@ -2316,11 +2317,11 @@ Class C End Class - TestSetDataTypeKind(code, expected, EnvDTE80.vsCMDataTypeKind.vsCMDataTypeKindMain) - End Sub + Await TestSetDataTypeKind(code, expected, EnvDTE80.vsCMDataTypeKind.vsCMDataTypeKindMain) + End Function - Public Sub SetDataTypeKind2() + Public Async Function TestSetDataTypeKind2() As Task Dim code = Class $$C @@ -2333,11 +2334,11 @@ Partial Class C End Class - TestSetDataTypeKind(code, expected, EnvDTE80.vsCMDataTypeKind.vsCMDataTypeKindPartial) - End Sub + Await TestSetDataTypeKind(code, expected, EnvDTE80.vsCMDataTypeKind.vsCMDataTypeKindPartial) + End Function - Public Sub SetDataTypeKind3() + Public Async Function TestSetDataTypeKind3() As Task Dim code = Partial Class $$C @@ -2350,11 +2351,11 @@ Class C End Class - TestSetDataTypeKind(code, expected, EnvDTE80.vsCMDataTypeKind.vsCMDataTypeKindMain) - End Sub + Await TestSetDataTypeKind(code, expected, EnvDTE80.vsCMDataTypeKind.vsCMDataTypeKindMain) + End Function - Public Sub SetDataTypeKind4() + Public Async Function TestSetDataTypeKind4() As Task Dim code = Module $$M @@ -2375,11 +2376,11 @@ Class M End Class - TestSetDataTypeKind(code, expected, EnvDTE80.vsCMDataTypeKind.vsCMDataTypeKindMain) - End Sub + Await TestSetDataTypeKind(code, expected, EnvDTE80.vsCMDataTypeKind.vsCMDataTypeKindMain) + End Function - Public Sub SetDataTypeKind5() + Public Async Function TestSetDataTypeKind5() As Task Dim code = Partial Class $$C @@ -2400,15 +2401,15 @@ Module C End Module - TestSetDataTypeKind(code, expected, EnvDTE80.vsCMDataTypeKind.vsCMDataTypeKindModule) - End Sub + Await TestSetDataTypeKind(code, expected, EnvDTE80.vsCMDataTypeKind.vsCMDataTypeKindModule) + End Function #End Region #Region "Set Comment tests" - Public Sub SetComment1() + Public Async Function TestSetComment1() As Task Dim code = ' Foo @@ -2426,11 +2427,11 @@ Class C End Class - TestSetComment(code, expected, Nothing) - End Sub + Await TestSetComment(code, expected, Nothing) + End Function - Public Sub SetComment2() + Public Async Function TestSetComment2() As Task Dim code = ' Foo @@ -2448,11 +2449,11 @@ Class C End Class - TestSetComment(code, expected, "Bar") - End Sub + Await TestSetComment(code, expected, "Bar") + End Function - Public Sub SetComment3() + Public Async Function TestSetComment3() As Task Dim code = ' Foo @@ -2471,15 +2472,15 @@ Class C End Class - TestSetComment(code, expected, "Blah") - End Sub + Await TestSetComment(code, expected, "Blah") + End Function #End Region #Region "Set DocComment tests" - Public Sub SetDocComment_Nothing1() + Public Async Function TestSetDocComment_Nothing1() As Task Dim code = Class $$C @@ -2492,11 +2493,11 @@ Class C End Class - TestSetDocComment(code, expected, Nothing) - End Sub + Await TestSetDocComment(code, expected, Nothing) + End Function - Public Sub SetDocComment_Nothing2() + Public Async Function TestSetDocComment_Nothing2() As Task Dim code = ''' <summary> @@ -2512,11 +2513,11 @@ Class C End Class - TestSetDocComment(code, expected, Nothing) - End Sub + Await TestSetDocComment(code, expected, Nothing) + End Function - Public Sub SetDocComment_InvalidXml1() + Public Async Function TestSetDocComment_InvalidXml1() As Task Dim code = Class $$C @@ -2530,11 +2531,11 @@ Class C End Class - TestSetDocComment(code, expected, "Blah") - End Sub + Await TestSetDocComment(code, expected, "Blah") + End Function - Public Sub SetDocComment_InvalidXml2() + Public Async Function TestSetDocComment_InvalidXml2() As Task Dim code = Class $$C @@ -2548,11 +2549,11 @@ Class C End Class - TestSetDocComment(code, expected, "Blah") - End Sub + Await TestSetDocComment(code, expected, "Blah") + End Function - Public Sub SetDocComment1() + Public Async Function TestSetDocComment1() As Task Dim code = Class $$C @@ -2566,11 +2567,11 @@ Class C End Class - TestSetDocComment(code, expected, "Hello World") - End Sub + Await TestSetDocComment(code, expected, "Hello World") + End Function - Public Sub SetDocComment2() + Public Async Function TestSetDocComment2() As Task Dim code = ''' <summary>Hello World</summary> @@ -2585,11 +2586,11 @@ Class C End Class - TestSetDocComment(code, expected, "Blah") - End Sub + Await TestSetDocComment(code, expected, "Blah") + End Function - Public Sub SetDocComment3() + Public Async Function TestSetDocComment3() As Task Dim code = ' Foo @@ -2605,11 +2606,11 @@ Class C End Class - TestSetDocComment(code, expected, "Blah") - End Sub + Await TestSetDocComment(code, expected, "Blah") + End Function - Public Sub SetDocComment4() + Public Async Function TestSetDocComment4() As Task Dim code = ''' <summary>FogBar</summary> @@ -2626,11 +2627,11 @@ Class C End Class - TestSetDocComment(code, expected, "Blah") - End Sub + Await TestSetDocComment(code, expected, "Blah") + End Function - Public Sub SetDocComment5() + Public Async Function TestSetDocComment5() As Task Dim code = Namespace N @@ -2648,15 +2649,15 @@ Namespace N End Namespace - TestSetDocComment(code, expected, "Hello World") - End Sub + Await TestSetDocComment(code, expected, "Hello World") + End Function #End Region #Region "Set InheritanceKind tests" - Public Sub SetInheritanceKind1() + Public Async Function TestSetInheritanceKind1() As Task Dim code = Class $$C @@ -2669,11 +2670,11 @@ MustInherit Class C End Class - TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract) - End Sub + Await TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract) + End Function - Public Sub SetInheritanceKind2() + Public Async Function TestSetInheritanceKind2() As Task Dim code = Class $$C @@ -2686,11 +2687,11 @@ NotInheritable Class C End Class - TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindSealed) - End Sub + Await TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindSealed) + End Function - Public Sub SetInheritanceKind3() + Public Async Function TestSetInheritanceKind3() As Task Dim code = Class C @@ -2707,11 +2708,11 @@ Class C End Class - TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract) - End Sub + Await TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindAbstract) + End Function - Public Sub SetInheritanceKind4() + Public Async Function TestSetInheritanceKind4() As Task Dim code = Class C @@ -2728,15 +2729,15 @@ Class C End Class - TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindSealed Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) - End Sub + Await TestSetInheritanceKind(code, expected, EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindSealed Or EnvDTE80.vsCMInheritanceKind.vsCMInheritanceKindNew) + End Function #End Region #Region "Set IsAbstract tests" - Public Sub SetIsAbstract1() + Public Async Function TestSetIsAbstract1() As Task Dim code = Class $$C : End Class @@ -2747,11 +2748,11 @@ Class $$C : End Class MustInherit Class C : End Class - TestSetIsAbstract(code, expected, True) - End Sub + Await TestSetIsAbstract(code, expected, True) + End Function - Public Sub SetIsAbstract2() + Public Async Function TestSetIsAbstract2() As Task Dim code = MustInherit $$Class C : End Class @@ -2762,11 +2763,11 @@ MustInherit $$Class C : End Class Class C : End Class - TestSetIsAbstract(code, expected, False) - End Sub + Await TestSetIsAbstract(code, expected, False) + End Function - Public Sub SetIsAbstract3() + Public Async Function TestSetIsAbstract3() As Task Dim code = Class $$C @@ -2779,11 +2780,11 @@ MustInherit Class C End Class - TestSetIsAbstract(code, expected, True) - End Sub + Await TestSetIsAbstract(code, expected, True) + End Function - Public Sub SetIsAbstract4() + Public Async Function TestSetIsAbstract4() As Task Dim code = MustInherit Class $$C @@ -2796,11 +2797,11 @@ Class C End Class - TestSetIsAbstract(code, expected, False) - End Sub + Await TestSetIsAbstract(code, expected, False) + End Function - Public Sub SetIsAbstract5() + Public Async Function TestSetIsAbstract5() As Task ' Note: This is a behavior change from Dev11 where VB code model will blow ' out the Shadows modifier when setting IsAbstract. @@ -2820,11 +2821,11 @@ Class C End Class - TestSetIsAbstract(code, expected, True) - End Sub + Await TestSetIsAbstract(code, expected, True) + End Function - Public Sub SetIsAbstract6() + Public Async Function TestSetIsAbstract6() As Task ' Note: This is a behavior change from Dev11 where VB code model will blow ' out the Shadows modifier when setting IsAbstract. @@ -2844,11 +2845,11 @@ Class C End Class - TestSetIsAbstract(code, expected, False) - End Sub + Await TestSetIsAbstract(code, expected, False) + End Function - Public Sub SetIsAbstract7() + Public Async Function TestSetIsAbstract7() As Task Dim code = NotInheritable Class $$C @@ -2861,15 +2862,15 @@ MustInherit Class C End Class - TestSetIsAbstract(code, expected, True) - End Sub + Await TestSetIsAbstract(code, expected, True) + End Function #End Region #Region "Set IsShared tests" - Public Sub SetIsShared1() + Public Async Function TestSetIsShared1() As Task Dim code = Class $$C : End Class @@ -2879,11 +2880,11 @@ Class $$C : End Class Class C : End Class - TestSetIsShared(code, expected, True, ThrowsNotImplementedException(Of Boolean)) - End Sub + Await TestSetIsShared(code, expected, True, ThrowsNotImplementedException(Of Boolean)) + End Function - Public Sub SetIsShared2() + Public Async Function TestSetIsShared2() As Task Dim code = Module $$M : End Module @@ -2894,14 +2895,14 @@ Module $$M : End Module Module M : End Module - TestSetIsShared(code, expected, True, ThrowsNotImplementedException(Of Boolean)) - End Sub + Await TestSetIsShared(code, expected, True, ThrowsNotImplementedException(Of Boolean)) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = Class $$Foo @@ -2914,13 +2915,13 @@ Class Bar End Class - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region #Region "NameSpace Tests" - Public Sub GetNamespaceNameFromInnerClass() + Public Async Function TestGetNamespaceNameFromInnerClass() As Task Dim code = Namespace NS1 @@ -2931,11 +2932,11 @@ Namespace NS1 End NameSpace - TestNamespaceName(code, "NS1") - End Sub + Await TestNamespaceName(code, "NS1") + End Function - Public Sub GetNamespaceNameFromOuterClass() + Public Async Function TestGetNamespaceNameFromOuterClass() As Task Dim code = Namespace NS1 @@ -2946,25 +2947,25 @@ Namespace NS1 End NameSpace - TestNamespaceName(code, "NS1") - End Sub + Await TestNamespaceName(code, "NS1") + End Function #End Region #Region "GenericExtender" - Public Sub GenericExtender_GetBaseTypesCount_Class1() + Public Async Function TestGenericExtender_GetBaseTypesCount_Class1() As Task Dim code = Class C$$ End Class - TestGenericNameExtender_GetBaseTypesCount(code, 1) - End Sub + Await TestGenericNameExtender_GetBaseTypesCount(code, 1) + End Function - Public Sub GenericExtender_GetBaseTypesCount_Class2() + Public Async Function TestGenericExtender_GetBaseTypesCount_Class2() As Task Dim code = Class C$$ @@ -2975,22 +2976,22 @@ Class B End Class - TestGenericNameExtender_GetBaseTypesCount(code, 1) - End Sub + Await TestGenericNameExtender_GetBaseTypesCount(code, 1) + End Function - Public Sub GenericExtender_GetBaseGenericName_Class1() + Public Async Function TestGenericExtender_GetBaseGenericName_Class1() As Task Dim code = Class C$$ End Class - TestGenericNameExtender_GetBaseGenericName(code, 1, "Object") - End Sub + Await TestGenericNameExtender_GetBaseGenericName(code, 1, "Object") + End Function - Public Sub GenericExtender_GetBaseGenericName_Class2() + Public Async Function TestGenericExtender_GetBaseGenericName_Class2() As Task Dim code = Class C$$ @@ -3001,22 +3002,22 @@ Class B End Class - TestGenericNameExtender_GetBaseGenericName(code, 1, "B") - End Sub + Await TestGenericNameExtender_GetBaseGenericName(code, 1, "B") + End Function - Public Sub GenericExtender_GetImplementedTypesCount_Class1() + Public Async Function TestGenericExtender_GetImplementedTypesCount_Class1() As Task Dim code = Class C$$ End Class - TestGenericNameExtender_GetImplementedTypesCount(code, 0) - End Sub + Await TestGenericNameExtender_GetImplementedTypesCount(code, 0) + End Function - Public Sub GenericExtender_GetImplementedTypesCount_Class2() + Public Async Function TestGenericExtender_GetImplementedTypesCount_Class2() As Task Dim code = Class C$$ @@ -3027,22 +3028,22 @@ Interface IFoo(Of T) End Interface - TestGenericNameExtender_GetImplementedTypesCount(code, 1) - End Sub + Await TestGenericNameExtender_GetImplementedTypesCount(code, 1) + End Function - Public Sub GenericExtender_GetImplTypeGenericName_Class1() + Public Async Function TestGenericExtender_GetImplTypeGenericName_Class1() As Task Dim code = Class C$$ End Class - TestGenericNameExtender_GetImplTypeGenericName(code, 1, Nothing) - End Sub + Await TestGenericNameExtender_GetImplTypeGenericName(code, 1, Nothing) + End Function - Public Sub GenericExtender_GetImplTypeGenericName_Class2() + Public Async Function TestGenericExtender_GetImplTypeGenericName_Class2() As Task Dim code = Class C$$ @@ -3053,57 +3054,57 @@ Interface IFoo(Of T) End Interface - TestGenericNameExtender_GetImplTypeGenericName(code, 1, "IFoo(Of String)") - End Sub + Await TestGenericNameExtender_GetImplTypeGenericName(code, 1, "IFoo(Of String)") + End Function - Public Sub GenericExtender_GetBaseTypesCount_Module() + Public Async Function TestGenericExtender_GetBaseTypesCount_Module() As Task Dim code = Module M$$ End Module - TestGenericNameExtender_GetBaseTypesCount(code, 1) - End Sub + Await TestGenericNameExtender_GetBaseTypesCount(code, 1) + End Function - Public Sub GenericExtender_GetBaseGenericName_Module() + Public Async Function TestGenericExtender_GetBaseGenericName_Module() As Task Dim code = Module M$$ End Module - TestGenericNameExtender_GetBaseGenericName(code, 1, "Object") - End Sub + Await TestGenericNameExtender_GetBaseGenericName(code, 1, "Object") + End Function - Public Sub GenericExtender_GetImplementedTypesCount_Module() + Public Async Function TestGenericExtender_GetImplementedTypesCount_Module() As Task Dim code = Module M$$ End Module - TestGenericNameExtender_GetImplementedTypesCountThrows(Of ArgumentException)(code) - End Sub + Await TestGenericNameExtender_GetImplementedTypesCountThrows(Of ArgumentException)(code) + End Function - Public Sub GenericExtender_GetImplTypeGenericName_Module() + Public Async Function TestGenericExtender_GetImplTypeGenericName_Module() As Task Dim code = Module M$$ End Module - TestGenericNameExtender_GetImplTypeGenericNameThrows(Of ArgumentException)(code, 1) - End Sub + Await TestGenericNameExtender_GetImplTypeGenericNameThrows(Of ArgumentException)(code, 1) + End Function #End Region - Public Sub GetBaseName1() + Public Async Function TestGetBaseName1() As Task Dim code = Imports N.M @@ -3120,11 +3121,11 @@ Class $$C End Class - TestGetBaseName(code, "N.M.Generic(Of String)") - End Sub + Await TestGetBaseName(code, "N.M.Generic(Of String)") + End Function - Public Sub ExternalClass_ImplementedInterfaces() + Public Async Function TestExternalClass_ImplementedInterfaces() As Task Dim code = Class $$Foo @@ -3132,17 +3133,17 @@ Class $$Foo End Class - TestElement(code, + Await TestElement(code, Sub(codeClass) Dim listType = TryCast(codeClass.Bases.Item(1), EnvDTE80.CodeClass2) Assert.NotNull(listType) Assert.Equal(8, listType.ImplementedInterfaces.Count) End Sub) - End Sub + End Function - Public Sub ClassMembersForWithEventsField() + Public Async Function TestClassMembersForWithEventsField() As Task Dim code = Class C @@ -3159,7 +3160,7 @@ Class D$$ End Class - TestElement(code, + Await TestElement(code, Sub(codeElement) Dim members = codeElement.Members Assert.Equal(2, members.Count) @@ -3172,10 +3173,10 @@ End Class Assert.Equal("D_E", member2.Name) Assert.Equal(EnvDTE.vsCMElement.vsCMElementFunction, member2.Kind) End Sub) - End Sub + End Function - Public Sub ClassIncludedDeclareMethods() + Public Async Function TestClassIncludedDeclareMethods() As Task Dim code = Public Class $$C1 @@ -3188,7 +3189,7 @@ Public Class $$C1 End Class - TestElement(code, + Await TestElement(code, Sub(codeClass) Dim members = codeClass.Members Assert.Equal(4, members.Count) @@ -3209,7 +3210,7 @@ End Class Assert.NotNull(member4) Assert.Equal("MethodD", member4.Name) End Sub) - End Sub + End Function Private Function GetGenericExtender(codeElement As EnvDTE80.CodeClass2) As IVBGenericExtender Return CType(codeElement.Extender(ExtenderNames.VBGenericExtender), IVBGenericExtender) diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeDelegateTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeDelegateTests.vb index 8df073488245511173a45442551b67d34e9f7cce..bdc2385e7507cda63970dc5e3a553a1258034dfe 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeDelegateTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeDelegateTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.CodeModel.Extenders Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.CodeModel.Interop @@ -12,13 +13,13 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "GetStartPoint() tests" - Public Sub GetStartPoint1() + Public Async Function TestGetStartPoint1() As Task Dim code = Delegate Sub $$Foo(i As Integer) - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -39,17 +40,17 @@ Delegate Sub $$Foo(i As Integer) TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=30)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=30))) - End Sub + End Function - Public Sub GetStartPoint2() + Public Async Function TestGetStartPoint2() As Task Dim code = <System.CLSCompliant(True)> Delegate Sub $$Foo(i As Integer) - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=27)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -70,20 +71,20 @@ Delegate Sub $$Foo(i As Integer) TextPoint(line:=2, lineOffset:=1, absoluteOffset:=29, lineLength:=30)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=27))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint1() + Public Async Function TestGetEndPoint1() As Task Dim code = Delegate Sub $$Foo(i As Integer) - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -104,17 +105,17 @@ Delegate Sub $$Foo(i As Integer) TextPoint(line:=1, lineOffset:=31, absoluteOffset:=31, lineLength:=30)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=31, absoluteOffset:=31, lineLength:=30))) - End Sub + End Function - Public Sub GetEndPoint2() + Public Async Function TestGetEndPoint2() As Task Dim code = <System.CLSCompliant(True)> Delegate Sub $$Foo(i As Integer) - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=1, lineOffset:=28, absoluteOffset:=28, lineLength:=27)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -135,14 +136,14 @@ Delegate Sub $$Foo(i As Integer) TextPoint(line:=2, lineOffset:=31, absoluteOffset:=59, lineLength:=30)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=31, absoluteOffset:=59, lineLength:=30))) - End Sub + End Function #End Region #Region "Attributes" - Public Sub Attributes() + Public Async Function TestAttributes1() As Task Dim code = Imports System @@ -151,76 +152,76 @@ Imports System Delegate Sub $$D() - TestAttributes(code, IsElement("CLSCompliant")) - End Sub + Await TestAttributes(code, IsElement("CLSCompliant")) + End Function #End Region #Region "BaseClass tests" - Public Sub BaseClass() + Public Async Function TestBaseClass1() As Task Dim code = Delegate Sub $$D() - TestBaseClass(code, "System.Delegate") - End Sub + Await TestBaseClass(code, "System.Delegate") + End Function #End Region #Region "Type tests" - Public Sub Type_Void() + Public Async Function TestType_Void() As Task Dim code = Delegate Sub $$D() - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "Void", .AsFullName = "System.Void", .CodeTypeFullName = "System.Void", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefVoid }) - End Sub + End Function - Public Sub Type_Int() + Public Async Function TestType_Int() As Task Dim code = Delegate Function $$D() As Integer - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "Integer", .AsFullName = "System.Int32", .CodeTypeFullName = "System.Int32", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefInt }) - End Sub + End Function - Public Sub Type_SourceClass() + Public Async Function TestType_SourceClass() As Task Dim code = Class C : End Class Delegate Function $$D() As C - TestTypeProp(code, New CodeTypeRefData With {.CodeTypeFullName = "C", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType}) - End Sub + Await TestTypeProp(code, New CodeTypeRefData With {.CodeTypeFullName = "C", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType}) + End Function #End Region #Region "Set Type tests" - Public Sub SetType1() + Public Async Function TestSetType1() As Task Dim code = Delegate Sub $$D() @@ -231,11 +232,11 @@ Delegate Sub $$D() Delegate Function D() As Integer - TestSetTypeProp(code, expected, "Integer") - End Sub + Await TestSetTypeProp(code, expected, "Integer") + End Function - Public Sub SetType2() + Public Async Function TestSetType2() As Task Dim code = Delegate Function $$D() As Integer @@ -246,11 +247,11 @@ Delegate Function $$D() As Integer Delegate Function D() As Decimal - TestSetTypeProp(code, expected, "System.Decimal") - End Sub + Await TestSetTypeProp(code, expected, "System.Decimal") + End Function - Public Sub SetType3() + Public Async Function TestSetType3() As Task Dim code = Delegate Function $$D() As Integer @@ -261,11 +262,11 @@ Delegate Function $$D() As Integer Delegate Sub D() - TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) - End Sub + Await TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) + End Function - Public Sub SetType4() + Public Async Function TestSetType4() As Task Dim code = Class C @@ -280,11 +281,11 @@ Class C End Class - TestSetTypeProp(code, expected, "Integer") - End Sub + Await TestSetTypeProp(code, expected, "Integer") + End Function - Public Sub SetType5() + Public Async Function TestSetType5() As Task Dim code = Class C @@ -299,11 +300,11 @@ Class C End Class - TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) - End Sub + Await TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) + End Function - Public Sub SetType6() + Public Async Function TestSetType6() As Task Dim code = Class C @@ -318,15 +319,15 @@ Class C End Class - TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) - End Sub + Await TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) + End Function #End Region #Region "AddParameter tests" - Public Sub AddParameter1() + Public Async Function TestAddParameter1() As Task Dim code = Delegate Sub $$M() @@ -337,11 +338,11 @@ Delegate Sub $$M() Delegate Sub M(a As Integer) - TestAddParameter(code, expected, New ParameterData With {.Name = "a", .Type = "Integer"}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "a", .Type = "Integer"}) + End Function - Public Sub AddParameter2() + Public Async Function TestAddParameter2() As Task Dim code = Delegate Sub $$M(a As Integer) @@ -352,11 +353,11 @@ Delegate Sub $$M(a As Integer) Delegate Sub M(b As String, a As Integer) - TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "String"}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "String"}) + End Function - Public Sub AddParameter3() + Public Async Function TestAddParameter3() As Task Dim code = Delegate Sub $$M(b As String, a As Integer) @@ -367,11 +368,11 @@ Delegate Sub $$M(b As String, a As Integer) Delegate Sub M(b As String, c As Boolean, a As Integer) - TestAddParameter(code, expected, New ParameterData With {.Name = "c", .Type = "System.Boolean", .Position = 1}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "c", .Type = "System.Boolean", .Position = 1}) + End Function - Public Sub AddParameter4() + Public Async Function TestAddParameter4() As Task Dim code = Delegate Sub $$M(a As Integer) @@ -382,15 +383,15 @@ Delegate Sub $$M(a As Integer) Delegate Sub M(a As Integer, b As String) - TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "String", .Position = -1}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "String", .Position = -1}) + End Function #End Region #Region "RemoveParameter tests" - Public Sub RemoveParameter1() + Public Async Function TestRemoveParameter1() As Task Dim code = Delegate Sub $$M(a As Integer) @@ -401,11 +402,11 @@ Delegate Sub $$M(a As Integer) Delegate Sub M() - TestRemoveChild(code, expected, "a") - End Sub + Await TestRemoveChild(code, expected, "a") + End Function - Public Sub RemoveParameter2() + Public Async Function TestRemoveParameter2() As Task Dim code = Delegate Sub $$M(a As Integer, b As String) @@ -416,11 +417,11 @@ Delegate Sub $$M(a As Integer, b As String) Delegate Sub M(a As Integer) - TestRemoveChild(code, expected, "b") - End Sub + Await TestRemoveChild(code, expected, "b") + End Function - Public Sub RemoveParameter3() + Public Async Function TestRemoveParameter3() As Task Dim code = Delegate Sub $$M(a As Integer, b As String) @@ -431,11 +432,11 @@ Delegate Sub $$M(a As Integer, b As String) Delegate Sub M(b As String) - TestRemoveChild(code, expected, "a") - End Sub + Await TestRemoveChild(code, expected, "a") + End Function - Public Sub RemoveParameter4() + Public Async Function TestRemoveParameter4() As Task Dim code = Delegate Sub $$M(a As Integer, b As String, c As Integer) @@ -446,52 +447,52 @@ Delegate Sub $$M(a As Integer, b As String, c As Integer) Delegate Sub M(a As Integer, c As Integer) - TestRemoveChild(code, expected, "b") - End Sub + Await TestRemoveChild(code, expected, "b") + End Function #End Region #Region "GenericExtender" - Public Sub GenericExtender_GetBaseTypesCount() + Public Async Function TestGenericExtender_GetBaseTypesCount() As Task Dim code = Delegate Sub $$D() - TestGenericNameExtender_GetBaseTypesCount(code, 1) - End Sub + Await TestGenericNameExtender_GetBaseTypesCount(code, 1) + End Function - Public Sub GenericExtender_GetBaseGenericName() + Public Async Function TestGenericExtender_GetBaseGenericName() As Task Dim code = Delegate Sub $$D() - TestGenericNameExtender_GetBaseGenericName(code, 1, "System.MulticastDelegate") - End Sub + Await TestGenericNameExtender_GetBaseGenericName(code, 1, "System.MulticastDelegate") + End Function - Public Sub GenericExtender_GetImplementedTypesCount() + Public Async Function TestGenericExtender_GetImplementedTypesCount() As Task Dim code = Delegate Sub $$D() - TestGenericNameExtender_GetImplementedTypesCountThrows(Of ArgumentException)(code) - End Sub + Await TestGenericNameExtender_GetImplementedTypesCountThrows(Of ArgumentException)(code) + End Function - Public Sub GenericExtender_GetImplTypeGenericName() + Public Async Function TestGenericExtender_GetImplTypeGenericName() As Task Dim code = Delegate Sub $$D() - TestGenericNameExtender_GetImplTypeGenericName(code, 1, Nothing) - End Sub + Await TestGenericNameExtender_GetImplTypeGenericName(code, 1, Nothing) + End Function #End Region @@ -499,32 +500,32 @@ Delegate Sub $$D() - Public Sub TestParameterNameWithEscapeCharacters() + Public Async Function TestParameterNameWithEscapeCharacters() As Task Dim code = Delegate Sub $$D([integer] as Integer) - TestAllParameterNames(code, "[integer]") - End Sub + Await TestAllParameterNames(code, "[integer]") + End Function - Public Sub TestParameterNameWithEscapeCharacters_2() + Public Async Function TestParameterNameWithEscapeCharacters_2() As Task Dim code = Delegate Sub $$D([integer] as Integer, [string] as String) - TestAllParameterNames(code, "[integer]", "[string]") - End Sub + Await TestAllParameterNames(code, "[integer]", "[string]") + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = Imports System @@ -539,11 +540,11 @@ Imports System <Serializable()> Delegate Sub M() - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = Imports System @@ -560,12 +561,12 @@ Imports System <CLSCompliant(true)> Delegate Sub M() - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment() + Public Async Function TestAddAttribute_BelowDocComment() As Task Dim code = Imports System @@ -582,8 +583,8 @@ Imports System <CLSCompliant(true)> Delegate Sub M() - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeEnumTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeEnumTests.vb index 8066038c5132d7b86d7a2e50e13fe789b4c4cb77..268147732bd793c4efd5ac1a8ed56f118e80fabf 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeEnumTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeEnumTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.CodeModel.Extenders Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.CodeModel.Interop @@ -12,7 +13,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "GetStartPoint() tests" - Public Sub GetStartPoint1() + Public Async Function TestGetStartPoint1() As Task Dim code = Enum E$$ @@ -20,7 +21,7 @@ Enum E$$ End Enum - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -41,14 +42,14 @@ End Enum TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=6)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=6))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint1() + Public Async Function TestGetEndPoint1() As Task Dim code = Enum E$$ @@ -56,7 +57,7 @@ Enum E$$ End Enum - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -77,24 +78,24 @@ End Enum TextPoint(line:=3, lineOffset:=9, absoluteOffset:=17, lineLength:=8)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=9, absoluteOffset:=17, lineLength:=8))) - End Sub + End Function #End Region #Region "Access tests" - Public Sub Access1() + Public Async Function TestAccess1() As Task Dim code = Enum $$E : End Enum - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access2() + Public Async Function TestAccess2() As Task Dim code = Class C @@ -102,65 +103,65 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access3() + Public Async Function TestAccess3() As Task Dim code = Private Enum $$E : End Enum - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access4() + Public Async Function TestAccess4() As Task Dim code = Protected Enum $$E : End Enum - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) + End Function - Public Sub Access5() + Public Async Function TestAccess5() As Task Dim code = Protected Friend Enum $$E : End Enum - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub Access6() + Public Async Function TestAccess6() As Task Dim code = Friend Enum $$E : End Enum - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access7() + Public Async Function TestAccess7() As Task Dim code = Public Enum $$E : End Enum - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = Imports System @@ -181,11 +182,11 @@ Enum E Bar End Enum - TestAddAttribute(code, expected, New AttributeData With {.Name = "Flags"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Flags"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = Imports System @@ -208,12 +209,12 @@ Enum E Bar End Enum - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment() + Public Async Function TestAddAttribute_BelowDocComment() As Task Dim code = Imports System @@ -236,14 +237,14 @@ Enum E Bar End Enum - TestAddAttribute(code, expected, New AttributeData With {.Name = "Flags"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Flags"}) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = Enum $$Foo @@ -256,55 +257,55 @@ Enum Bar End Enum - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region #Region "GenericExtender" - Public Sub GenericExtender_GetBaseTypesCount() + Public Async Function TestGenericExtender_GetBaseTypesCount() As Task Dim code = Enum E$$ End Enum - TestGenericNameExtender_GetBaseTypesCount(code, 1) - End Sub + Await TestGenericNameExtender_GetBaseTypesCount(code, 1) + End Function - Public Sub GenericExtender_GetBaseGenericName() + Public Async Function TestGenericExtender_GetBaseGenericName() As Task Dim code = Enum E$$ End Enum - TestGenericNameExtender_GetBaseGenericName(code, 1, "System.Enum") - End Sub + Await TestGenericNameExtender_GetBaseGenericName(code, 1, "System.Enum") + End Function - Public Sub GenericExtender_GetImplementedTypesCount() + Public Async Function TestGenericExtender_GetImplementedTypesCount() As Task Dim code = Enum E$$ End Enum - TestGenericNameExtender_GetImplementedTypesCountThrows(Of ArgumentException)(code) - End Sub + Await TestGenericNameExtender_GetImplementedTypesCountThrows(Of ArgumentException)(code) + End Function - Public Sub GenericExtender_GetImplTypeGenericName() + Public Async Function TestGenericExtender_GetImplTypeGenericName() As Task Dim code = Enum E$$ End Enum - TestGenericNameExtender_GetImplTypeGenericName(code, 1, Nothing) - End Sub + Await TestGenericNameExtender_GetImplTypeGenericName(code, 1, Nothing) + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeEventTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeEventTests.vb index e8e5f6fac84638891b1d0dd056b5a660e558958f..1684f308889bc453d0e29ccaad4969353553716b 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeEventTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeEventTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -11,7 +12,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi - Public Sub GetStartPoint_SimpleEvent() + Public Async Function TestGetStartPoint_SimpleEvent() As Task Dim code = Class C @@ -19,7 +20,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -40,11 +41,11 @@ End Class TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=25)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=25))) - End Sub + End Function - Public Sub GetStartPoint_SimpleEventWithAttributes() + Public Async Function TestGetStartPoint_SimpleEventWithAttributes() As Task Dim code = Class C @@ -53,7 +54,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -74,11 +75,11 @@ End Class TextPoint(line:=3, lineOffset:=5, absoluteOffset:=45, lineLength:=25)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=31))) - End Sub + End Function - Public Sub GetStartPoint_CustomEvent() + Public Async Function TestGetStartPoint_CustomEvent() As Task Dim code = Class C @@ -95,7 +96,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -116,11 +117,11 @@ End Class TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=41)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=41))) - End Sub + End Function - Public Sub GetStartPoint_CustomEventWithAttributes() + Public Async Function TestGetStartPoint_CustomEventWithAttributes() As Task Dim code = Class C @@ -138,7 +139,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -159,7 +160,7 @@ End Class TextPoint(line:=3, lineOffset:=5, absoluteOffset:=45, lineLength:=41)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=31))) - End Sub + End Function #End Region @@ -167,7 +168,7 @@ End Class - Public Sub GetEndPoint_SimpleEvent() + Public Async Function TestGetEndPoint_SimpleEvent() As Task Dim code = Class C @@ -175,7 +176,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -196,11 +197,11 @@ End Class TextPoint(line:=2, lineOffset:=26, absoluteOffset:=34, lineLength:=25)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=26, absoluteOffset:=34, lineLength:=25))) - End Sub + End Function - Public Sub GetEndPoint_SimpleEventWithAttributes() + Public Async Function TestGetEndPoint_SimpleEventWithAttributes() As Task Dim code = Class C @@ -209,7 +210,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=32, absoluteOffset:=40, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -230,11 +231,11 @@ End Class TextPoint(line:=3, lineOffset:=26, absoluteOffset:=66, lineLength:=25)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=26, absoluteOffset:=66, lineLength:=25))) - End Sub + End Function - Public Sub GetEndPoint_CustomEvent() + Public Async Function TestGetEndPoint_CustomEvent() As Task Dim code = Class C @@ -251,7 +252,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -272,11 +273,11 @@ End Class TextPoint(line:=11, lineOffset:=14, absoluteOffset:=299, lineLength:=13)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=11, lineOffset:=14, absoluteOffset:=299, lineLength:=13))) - End Sub + End Function - Public Sub GetEndPoint_CustomEventWithAttributes() + Public Async Function TestGetEndPoint_CustomEventWithAttributes() As Task Dim code = Class C @@ -294,7 +295,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=32, absoluteOffset:=40, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -315,14 +316,14 @@ End Class TextPoint(line:=12, lineOffset:=14, absoluteOffset:=331, lineLength:=13)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=12, lineOffset:=14, absoluteOffset:=331, lineLength:=13))) - End Sub + End Function #End Region #Region "Access tests" - Public Sub Access1() + Public Async Function TestAccess1() As Task Dim code = Class C @@ -330,11 +331,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access2() + Public Async Function TestAccess2() As Task Dim code = Class C @@ -342,11 +343,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access3() + Public Async Function TestAccess3() As Task Dim code = Class C @@ -354,11 +355,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) + End Function - Public Sub Access4() + Public Async Function TestAccess4() As Task Dim code = Class C @@ -366,11 +367,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub Access5() + Public Async Function TestAccess5() As Task Dim code = Class C @@ -378,11 +379,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access6() + Public Async Function TestAccess6() As Task Dim code = Class C @@ -390,15 +391,15 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function #End Region #Region "Attributes" - Public Sub Attributes_SimpleEvent() + Public Async Function TestAttributes_SimpleEvent() As Task Dim code = Imports System @@ -409,11 +410,11 @@ Class C1 End Class - TestAttributes(code, IsElement("CLSCompliant")) - End Sub + Await TestAttributes(code, IsElement("CLSCompliant")) + End Function - Public Sub Attributes_CustomEvent() + Public Async Function TestAttributes_CustomEvent() As Task Dim code = Imports System @@ -431,15 +432,15 @@ Class C1 End Class - TestAttributes(code, IsElement("CLSCompliant")) - End Sub + Await TestAttributes(code, IsElement("CLSCompliant")) + End Function #End Region #Region "IsPropertyStyleEvent tests" - Public Sub IsPropertyStyleEvent1() + Public Async Function TestIsPropertyStyleEvent1() As Task Dim code = Class C @@ -447,11 +448,11 @@ Class C End Class - TestIsPropertyStyleEvent(code, False) - End Sub + Await TestIsPropertyStyleEvent(code, False) + End Function - Public Sub IsPropertyStyleEvent2() + Public Async Function TestIsPropertyStyleEvent2() As Task Dim code = Class C @@ -459,11 +460,11 @@ Class C End Class - TestIsPropertyStyleEvent(code, False) - End Sub + Await TestIsPropertyStyleEvent(code, False) + End Function - Public Sub IsPropertyStyleEvent3() + Public Async Function TestIsPropertyStyleEvent3() As Task Dim code = Class C @@ -483,15 +484,15 @@ Class C End Class - TestIsPropertyStyleEvent(code, True) - End Sub + Await TestIsPropertyStyleEvent(code, True) + End Function #End Region #Region "IsShared tests" - Public Sub IsShared1() + Public Async Function TestIsShared1() As Task Dim code = Class C @@ -499,11 +500,11 @@ Class C End Class - TestIsShared(code, False) - End Sub + Await TestIsShared(code, False) + End Function - Public Sub IsShared2() + Public Async Function TestIsShared2() As Task Dim code = Class C @@ -511,11 +512,11 @@ Class C End Class - TestIsShared(code, True) - End Sub + Await TestIsShared(code, True) + End Function - Public Sub IsShared3() + Public Async Function TestIsShared3() As Task Dim code = Class C @@ -535,11 +536,11 @@ Class C End Class - TestIsShared(code, False) - End Sub + Await TestIsShared(code, False) + End Function - Public Sub IsShared4() + Public Async Function TestIsShared4() As Task Dim code = Class C @@ -559,14 +560,14 @@ Class C End Class - TestIsShared(code, True) - End Sub + Await TestIsShared(code, True) + End Function #End Region #Region "Name tests" - Public Sub Name1() + Public Async Function TestName1() As Task Dim code = Class C @@ -574,14 +575,14 @@ Class C End Class - TestName(code, "Foo") - End Sub + Await TestName(code, "Foo") + End Function #End Region #Region "Type tests" - Public Sub Type1() + Public Async Function TestType1() As Task Dim code = Class C @@ -589,17 +590,17 @@ Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "C.EEventHandler", .AsFullName = "C.EEventHandler", .CodeTypeFullName = "C.EEventHandler", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType }) - End Sub + End Function - Public Sub Type2() + Public Async Function TestType2() As Task Dim code = Class C @@ -607,17 +608,17 @@ Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "System.EventHandler", .AsFullName = "System.EventHandler", .CodeTypeFullName = "System.EventHandler", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType }) - End Sub + End Function - Public Sub Type3() + Public Async Function TestType3() As Task Dim code = Class C @@ -634,21 +635,21 @@ Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "System.EventHandler", .AsFullName = "System.EventHandler", .CodeTypeFullName = "System.EventHandler", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType }) - End Sub + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute_SimpleEvent() + Public Async Function TestAddAttribute_SimpleEvent() As Task Dim code = Imports System @@ -667,11 +668,11 @@ Class C Public Event E() End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_CustomEvent() + Public Async Function TestAddAttribute_CustomEvent() As Task Dim code = Imports System @@ -704,12 +705,12 @@ Class C End Event End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_SimpleEvent_BelowDocComment() + Public Async Function TestAddAttribute_SimpleEvent_BelowDocComment() As Task Dim code = Imports System @@ -730,12 +731,12 @@ Class C Public Event E() End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) + End Function - Public Sub AddAttribute_CustomEvent_BelowDocComment() + Public Async Function TestAddAttribute_CustomEvent_BelowDocComment() As Task Dim code = Imports System @@ -770,15 +771,15 @@ Class C End Event End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "true"}) + End Function #End Region #Region "Set IsShared tests" - Public Sub SetIsShared1() + Public Async Function TestSetIsShared1() As Task Dim code = Class C @@ -793,11 +794,11 @@ Class C End Class - TestSetIsShared(code, expected, False) - End Sub + Await TestSetIsShared(code, expected, False) + End Function - Public Sub SetIsShared2() + Public Async Function TestSetIsShared2() As Task Dim code = Class C @@ -812,11 +813,11 @@ Class C End Class - TestSetIsShared(code, expected, True) - End Sub + Await TestSetIsShared(code, expected, True) + End Function - Public Sub SetIsShared3() + Public Async Function TestSetIsShared3() As Task Dim code = Class C @@ -831,11 +832,11 @@ Class C End Class - TestSetIsShared(code, expected, True) - End Sub + Await TestSetIsShared(code, expected, True) + End Function - Public Sub SetIsShared4() + Public Async Function TestSetIsShared4() As Task Dim code = Class C @@ -850,11 +851,11 @@ Class C End Class - TestSetIsShared(code, expected, False) - End Sub + Await TestSetIsShared(code, expected, False) + End Function - Public Sub SetIsShared5() + Public Async Function TestSetIsShared5() As Task Dim code = Class C @@ -893,11 +894,11 @@ Class C End Class - TestSetIsShared(code, expected, False) - End Sub + Await TestSetIsShared(code, expected, False) + End Function - Public Sub SetIsShared6() + Public Async Function TestSetIsShared6() As Task Dim code = Class C @@ -936,11 +937,11 @@ Class C End Class - TestSetIsShared(code, expected, True) - End Sub + Await TestSetIsShared(code, expected, True) + End Function - Public Sub SetIsShared7() + Public Async Function TestSetIsShared7() As Task Dim code = Class C @@ -979,11 +980,11 @@ Class C End Class - TestSetIsShared(code, expected, True) - End Sub + Await TestSetIsShared(code, expected, True) + End Function - Public Sub SetIsShared8() + Public Async Function TestSetIsShared8() As Task Dim code = Class C @@ -1022,15 +1023,15 @@ Class C End Class - TestSetIsShared(code, expected, False) - End Sub + Await TestSetIsShared(code, expected, False) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = Class C @@ -1045,15 +1046,15 @@ Class C End Class - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region #Region "Set Type tests" - Public Sub SetType1() + Public Async Function TestSetType1() As Task Dim code = Class C @@ -1068,11 +1069,11 @@ Class C End Class - TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef), ThrowsArgumentException(Of EnvDTE.CodeTypeRef)) - End Sub + Await TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef), ThrowsArgumentException(Of EnvDTE.CodeTypeRef)) + End Function - Public Sub SetType2() + Public Async Function TestSetType2() As Task Dim code = Class C @@ -1087,11 +1088,11 @@ Class C End Class - TestSetTypeProp(code, expected, "System.EventHandler") - End Sub + Await TestSetTypeProp(code, expected, "System.EventHandler") + End Function - Public Sub SetType3() + Public Async Function TestSetType3() As Task Dim code = Class C @@ -1106,11 +1107,11 @@ Class C End Class - TestSetTypeProp(code, expected, "System.ConsoleCancelEventHandler") - End Sub + Await TestSetTypeProp(code, expected, "System.ConsoleCancelEventHandler") + End Function - Public Sub SetType4() + Public Async Function TestSetType4() As Task Dim code = Class C @@ -1143,8 +1144,8 @@ Class C End Class - TestSetTypeProp(code, expected, "System.ConsoleCancelEventHandler") - End Sub + Await TestSetTypeProp(code, expected, "System.ConsoleCancelEventHandler") + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeFunctionTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeFunctionTests.vb index 7ff2c96a4d2285ce7c5c9cefc011bc3962012bb5..c44289b06b1fe1bc8d8cd6ce291688c65c373be5 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeFunctionTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeFunctionTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.CodeModel.Extenders Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.CodeModel.Interop @@ -12,7 +13,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "GetStartPoint() tests" - Public Sub GetStartPoint_MustOverride1() + Public Async Function TestGetStartPoint_MustOverride1() As Task Dim code = MustInherit Class C @@ -20,7 +21,7 @@ MustInherit Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -41,10 +42,10 @@ End Class TextPoint(line:=2, lineOffset:=5, absoluteOffset:=25, lineLength:=24)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=25, lineLength:=24))) - End Sub + End Function - Public Sub GetStartPoint_MustOverride2() + Public Async Function TestGetStartPoint_MustOverride2() As Task Dim code = MustInherit Class C @@ -53,7 +54,7 @@ MustInherit Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=25, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -74,11 +75,11 @@ End Class TextPoint(line:=3, lineOffset:=5, absoluteOffset:=57, lineLength:=24)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=25, lineLength:=31))) - End Sub + End Function - Public Sub GetStartPoint_DeclareFunction_WithoutAttribute() + Public Async Function TestGetStartPoint_DeclareFunction_WithoutAttribute() As Task Dim code = Public Class C1 @@ -86,7 +87,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -107,11 +108,11 @@ End Class TextPoint(line:=2, lineOffset:=5, absoluteOffset:=21, lineLength:=59)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=21, lineLength:=59))) - End Sub + End Function - Public Sub GetStartPoint_DeclareFunction_WithAttribute() + Public Async Function TestGetStartPoint_DeclareFunction_WithAttribute() As Task Dim code = Public Class C1 @@ -120,7 +121,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=21, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -141,11 +142,11 @@ End Class TextPoint(line:=3, lineOffset:=5, absoluteOffset:=53, lineLength:=59)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=21, lineLength:=31))) - End Sub + End Function - Public Sub GetStartPoint_DeclareSub_WithoutAttribute() + Public Async Function TestGetStartPoint_DeclareSub_WithoutAttribute() As Task Dim code = Public Class C1 @@ -153,7 +154,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -174,11 +175,11 @@ End Class TextPoint(line:=2, lineOffset:=5, absoluteOffset:=21, lineLength:=47)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=21, lineLength:=47))) - End Sub + End Function - Public Sub GetStartPoint_DeclareSub_WithAttribute() + Public Async Function TestGetStartPoint_DeclareSub_WithAttribute() As Task Dim code = Public Class C1 @@ -187,7 +188,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=21, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -208,14 +209,14 @@ End Class TextPoint(line:=3, lineOffset:=5, absoluteOffset:=53, lineLength:=47)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=21, lineLength:=31))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint_MustOverride1() + Public Async Function TestGetEndPoint_MustOverride1() As Task Dim code = MustInherit Class C @@ -223,7 +224,7 @@ MustInherit Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -244,10 +245,10 @@ End Class TextPoint(line:=2, lineOffset:=25, absoluteOffset:=45, lineLength:=24)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=25, absoluteOffset:=45, lineLength:=24))) - End Sub + End Function - Public Sub GetEndPoint_MustOverride2() + Public Async Function TestGetEndPoint_MustOverride2() As Task Dim code = MustInherit Class C @@ -256,7 +257,7 @@ MustInherit Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=32, absoluteOffset:=52, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -277,11 +278,11 @@ End Class TextPoint(line:=3, lineOffset:=25, absoluteOffset:=77, lineLength:=24)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=25, absoluteOffset:=77, lineLength:=24))) - End Sub + End Function - Public Sub GetEndPoint_DeclareFunction_WithoutAttribute() + Public Async Function TestGetEndPoint_DeclareFunction_WithoutAttribute() As Task Dim code = Public Class C1 @@ -289,7 +290,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -310,11 +311,11 @@ End Class TextPoint(line:=2, lineOffset:=60, absoluteOffset:=76, lineLength:=59)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=60, absoluteOffset:=76, lineLength:=59))) - End Sub + End Function - Public Sub GetEndPoint_DeclareFunction_WithAttribute() + Public Async Function TestGetEndPoint_DeclareFunction_WithAttribute() As Task Dim code = Public Class C1 @@ -323,7 +324,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=32, absoluteOffset:=48, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -344,11 +345,11 @@ End Class TextPoint(line:=3, lineOffset:=60, absoluteOffset:=108, lineLength:=59)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=60, absoluteOffset:=108, lineLength:=59))) - End Sub + End Function - Public Sub GetEndPoint_DeclareSub_WithoutAttribute() + Public Async Function TestGetEndPoint_DeclareSub_WithoutAttribute() As Task Dim code = Public Class C1 @@ -356,7 +357,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -377,11 +378,11 @@ End Class TextPoint(line:=2, lineOffset:=45, absoluteOffset:=61, lineLength:=44)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=45, absoluteOffset:=61, lineLength:=44))) - End Sub + End Function - Public Sub GetEndPoint_DeclareSub_WithAttribute() + Public Async Function TestGetEndPoint_DeclareSub_WithAttribute() As Task Dim code = Public Class C1 @@ -390,7 +391,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=32, absoluteOffset:=48, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -411,14 +412,14 @@ End Class TextPoint(line:=3, lineOffset:=45, absoluteOffset:=93, lineLength:=44)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=45, absoluteOffset:=93, lineLength:=44))) - End Sub + End Function #End Region #Region "Access tests" - Public Sub Access1() + Public Async Function TestAccess1() As Task Dim code = Class C @@ -428,11 +429,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access2() + Public Async Function TestAccess2() As Task Dim code = Class C @@ -442,11 +443,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access3() + Public Async Function TestAccess3() As Task Dim code = Class C @@ -456,11 +457,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) + End Function - Public Sub Access4() + Public Async Function TestAccess4() As Task Dim code = Class C @@ -470,11 +471,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub Access5() + Public Async Function TestAccess5() As Task Dim code = Class C @@ -484,11 +485,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access6() + Public Async Function TestAccess6() As Task Dim code = Class C @@ -498,11 +499,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access7() + Public Async Function TestAccess7() As Task Dim code = Interface I @@ -510,15 +511,15 @@ Interface I End Interface - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function #End Region #Region "Attribute Tests" - Public Sub PropertyGetAttribute_WithNoSet() + Public Async Function TestPropertyGetAttribute_WithNoSet() As Task Dim code = Public Class Class1 @@ -531,12 +532,12 @@ Public Class Class1 End Class - TestAttributes(code, IsElement("Obsolete")) - End Sub + Await TestAttributes(code, IsElement("Obsolete")) + End Function - Public Sub PropertySetAttribute_WithNoGet() + Public Async Function TestPropertySetAttribute_WithNoGet() As Task Dim code = Public Class Class1 @@ -549,12 +550,12 @@ Public Class Class1 End Class - TestAttributes(code, IsElement("Obsolete")) - End Sub + Await TestAttributes(code, IsElement("Obsolete")) + End Function - Public Sub PropertySetAttribute_WithGet() + Public Async Function TestPropertySetAttribute_WithGet() As Task Dim code = Public Class Class1 @@ -571,12 +572,12 @@ Public Class Class1 End Class - TestAttributes(code, IsElement("Obsolete")) - End Sub + Await TestAttributes(code, IsElement("Obsolete")) + End Function - Public Sub PropertyGetAttribute_WithSet() + Public Async Function TestPropertyGetAttribute_WithSet() As Task Dim code = Public Class Class1 @@ -593,12 +594,12 @@ Public Class Class1 End Class - TestAttributes(code, IsElement("Obsolete")) - End Sub + Await TestAttributes(code, IsElement("Obsolete")) + End Function - Public Sub Attribute_1() + Public Async Function TestAttribute_1() As Task Dim code = Class Program @@ -609,14 +610,14 @@ Class Program End Class - TestAttributes(code, IsElement("Obsolete")) - End Sub + Await TestAttributes(code, IsElement("Obsolete")) + End Function #End Region #Region "CanOverride tests" - Public Sub CanOverride1() + Public Async Function TestCanOverride1() As Task Dim code = MustInherit Class C @@ -624,11 +625,11 @@ MustInherit Class C End Class - TestCanOverride(code, True) - End Sub + Await TestCanOverride(code, True) + End Function - Public Sub CanOverride2() + Public Async Function TestCanOverride2() As Task Dim code = Interface I @@ -636,11 +637,11 @@ Interface I End Interface - TestCanOverride(code, True) - End Sub + Await TestCanOverride(code, True) + End Function - Public Sub CanOverride3() + Public Async Function TestCanOverride3() As Task Dim code = Class C @@ -650,11 +651,11 @@ Class C End Class - TestCanOverride(code, True) - End Sub + Await TestCanOverride(code, True) + End Function - Public Sub CanOverride4() + Public Async Function TestCanOverride4() As Task Dim code = Class C @@ -664,11 +665,11 @@ Class C End Class - TestCanOverride(code, False) - End Sub + Await TestCanOverride(code, False) + End Function - Public Sub CanOverride5() + Public Async Function TestCanOverride5() As Task Dim code = Class B @@ -686,11 +687,11 @@ Class C End Class - TestCanOverride(code, True) - End Sub + Await TestCanOverride(code, True) + End Function - Public Sub CanOverride6() + Public Async Function TestCanOverride6() As Task Dim code = Class B @@ -708,8 +709,8 @@ Class C End Class - TestCanOverride(code, False) - End Sub + Await TestCanOverride(code, False) + End Function #End Region @@ -717,7 +718,7 @@ End Class - Public Sub FunctionKind_Constructor() + Public Async Function TestFunctionKind_Constructor() As Task Dim code = Public Class C1 @@ -728,11 +729,11 @@ Public Class C1 End Clas - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionConstructor) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionConstructor) + End Function - Public Sub FunctionKind_Destructor() + Public Async Function TestFunctionKind_Destructor() As Task Dim code = Public Class C1 @@ -744,11 +745,11 @@ Public Class C1 End Clas - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionDestructor) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionDestructor) + End Function - Public Sub FunctionKind_Sub() + Public Async Function TestFunctionKind_Sub() As Task Dim code = Public Class C1 @@ -759,11 +760,11 @@ Public Class C1 End Clas - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionSub) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionSub) + End Function - Public Sub FunctionKind_Function() + Public Async Function TestFunctionKind_Function() As Task Dim code = Public Class C1 @@ -774,11 +775,11 @@ Public Class C1 End Clas - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionFunction) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionFunction) + End Function - Public Sub FunctionKind_DeclareSub() + Public Async Function TestFunctionKind_DeclareSub() As Task Dim code = Public Class C1 @@ -788,11 +789,11 @@ Public Class C1 End Clas - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionSub) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionSub) + End Function - Public Sub FunctionKind_DeclareFunction() + Public Async Function TestFunctionKind_DeclareFunction() As Task Dim code = Public Class C1 @@ -802,11 +803,11 @@ Public Class C1 End Clas - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionFunction) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionFunction) + End Function - Public Sub FunctionKind__Operator() + Public Async Function TestFunctionKind__Operator() As Task Dim code = Imports System @@ -817,11 +818,11 @@ Class C End Class - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionOperator) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionOperator) + End Function - Public Sub FunctionKind_Conversion() + Public Async Function TestFunctionKind_Conversion() As Task Dim code = Imports System @@ -832,15 +833,15 @@ Class C End Class - TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionOperator) - End Sub + Await TestFunctionKind(code, EnvDTE.vsCMFunction.vsCMFunctionOperator) + End Function #End Region #Region "MustImplement tests" - Public Sub MustImplement1() + Public Async Function TestMustImplement1() As Task Dim code = MustInherit Class C @@ -848,11 +849,11 @@ MustInherit Class C End Class - TestMustImplement(code, True) - End Sub + Await TestMustImplement(code, True) + End Function - Public Sub MustImplement2() + Public Async Function TestMustImplement2() As Task Dim code = Interface I @@ -860,11 +861,11 @@ Interface I End Interface - TestMustImplement(code, True) - End Sub + Await TestMustImplement(code, True) + End Function - Public Sub MustImplement3() + Public Async Function TestMustImplement3() As Task Dim code = Class C @@ -874,11 +875,11 @@ Class C End Class - TestMustImplement(code, False) - End Sub + Await TestMustImplement(code, False) + End Function - Public Sub MustImplement4() + Public Async Function TestMustImplement4() As Task Dim code = Class C @@ -888,11 +889,11 @@ Class C End Class - TestMustImplement(code, False) - End Sub + Await TestMustImplement(code, False) + End Function - Public Sub MustImplement5() + Public Async Function TestMustImplement5() As Task Dim code = Class B @@ -910,11 +911,11 @@ Class C End Class - TestMustImplement(code, False) - End Sub + Await TestMustImplement(code, False) + End Function - Public Sub MustImplement6() + Public Async Function TestMustImplement6() As Task Dim code = Class B @@ -932,15 +933,15 @@ Class C End Class - TestMustImplement(code, False) - End Sub + Await TestMustImplement(code, False) + End Function #End Region #Region "Name tests" - Public Sub Name1() + Public Async Function TestName1() As Task Dim code = Class C @@ -948,11 +949,11 @@ Class C End Class - TestName(code, "Foo") - End Sub + Await TestName(code, "Foo") + End Function - Public Sub Name_NoParens() + Public Async Function TestName_NoParens() As Task Dim code = Class C @@ -960,11 +961,11 @@ Class C End Class - TestName(code, "Foo") - End Sub + Await TestName(code, "Foo") + End Function - Public Sub Name_Constructor1() + Public Async Function TestName_Constructor1() As Task Dim code = Class C @@ -973,11 +974,11 @@ Class C End Class - TestName(code, "New") - End Sub + Await TestName(code, "New") + End Function - Public Sub Name_Constructor2() + Public Async Function TestName_Constructor2() As Task Dim code = Class C @@ -985,11 +986,11 @@ Class C End Class - TestName(code, "New") - End Sub + Await TestName(code, "New") + End Function - Public Sub Name_Operator1() + Public Async Function TestName_Operator1() As Task Dim code = Class C @@ -998,11 +999,11 @@ Class C End Class - TestName(code, "CType") - End Sub + Await TestName(code, "CType") + End Function - Public Sub Name_Operator2() + Public Async Function TestName_Operator2() As Task Dim code = Class C @@ -1010,11 +1011,11 @@ Class C End Class - TestName(code, "CType") - End Sub + Await TestName(code, "CType") + End Function - Public Sub Name_Operator3() + Public Async Function TestName_Operator3() As Task Dim code = Class C @@ -1023,8 +1024,8 @@ Class C End Class - TestName(code, "*") - End Sub + Await TestName(code, "*") + End Function #End Region @@ -1032,7 +1033,7 @@ End Class - Public Sub DeclareSubKind() + Public Async Function TestDeclareSubKind() As Task Dim code = Public Class Class1 @@ -1040,12 +1041,12 @@ Public Declare Sub $$f1 Lib "MyLib.dll" () End Class - TestKind(code, EnvDTE.vsCMElement.vsCMElementDeclareDecl) - End Sub + Await TestKind(code, EnvDTE.vsCMElement.vsCMElementDeclareDecl) + End Function - Public Sub DeclareFunctionKind() + Public Async Function TestDeclareFunctionKind() As Task Dim code = Public Class Class1 @@ -1053,12 +1054,12 @@ Public Declare Function f2$$ Lib "MyLib.dll" () As Integer End Class - TestKind(code, EnvDTE.vsCMElement.vsCMElementDeclareDecl) - End Sub + Await TestKind(code, EnvDTE.vsCMElement.vsCMElementDeclareDecl) + End Function - Public Sub SubKind() + Public Async Function TestSubKind() As Task Dim code = Public Class Class1 @@ -1067,14 +1068,14 @@ Public Class Class1 End Class - TestKind(code, EnvDTE.vsCMElement.vsCMElementFunction) - End Sub + Await TestKind(code, EnvDTE.vsCMElement.vsCMElementFunction) + End Function #End Region #Region "OverrideKind tests" - Public Sub OverrideKind_Abstract() + Public Async Function TestOverrideKind_Abstract() As Task Dim code = MustInherit Class C @@ -1082,11 +1083,11 @@ MustInherit Class C End Class - TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) - End Sub + Await TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) + End Function - Public Sub OverrideKind_Virtual() + Public Async Function TestOverrideKind_Virtual() As Task Dim code = Class C @@ -1095,11 +1096,11 @@ Class C End Class - TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindVirtual) - End Sub + Await TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindVirtual) + End Function - Public Sub OverrideKind_Sealed() + Public Async Function TestOverrideKind_Sealed() As Task Dim code = Class C @@ -1108,11 +1109,11 @@ Class C End Class - TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindSealed) - End Sub + Await TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindSealed) + End Function - Public Sub OverrideKind_Override() + Public Async Function TestOverrideKind_Override() As Task Dim code = MustInherit Class B @@ -1127,11 +1128,11 @@ Class C End Class - TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindOverride) - End Sub + Await TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindOverride) + End Function - Public Sub OverrideKind_New() + Public Async Function TestOverrideKind_New() As Task Dim code = MustInherit Class B @@ -1146,15 +1147,15 @@ Class C End Class - TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNew) - End Sub + Await TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNew) + End Function #End Region #Region "Prototype tests" - Public Sub Prototype_UniqueSignature() + Public Async Function TestPrototype_UniqueSignature() As Task Dim code = Namespace N @@ -1165,11 +1166,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature, "M:N.C.Foo") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature, "M:N.C.Foo") + End Function - Public Sub Prototype_FullName() + Public Async Function TestPrototype_FullName() As Task Dim code = Namespace N @@ -1180,11 +1181,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "N.C.Foo()") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "N.C.Foo()") + End Function - Public Sub Prototype_ClassName() + Public Async Function TestPrototype_ClassName() As Task Dim code = Namespace N @@ -1195,11 +1196,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.Foo()") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.Foo()") + End Function - Public Sub Prototype_Type1() + Public Async Function TestPrototype_Type1() As Task Dim code = Namespace N @@ -1210,11 +1211,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "Foo()") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "Foo()") + End Function - Public Sub Prototype_Type2() + Public Async Function TestPrototype_Type2() As Task Dim code = Namespace N @@ -1225,15 +1226,15 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "Foo() As Integer") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "Foo() As Integer") + End Function #End Region #Region "Type tests" - Public Sub Type1() + Public Async Function TestType1() As Task Dim code = Class C @@ -1242,17 +1243,17 @@ Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "Void", .AsFullName = "System.Void", .CodeTypeFullName = "System.Void", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefVoid }) - End Sub + End Function - Public Sub Type2() + Public Async Function TestType2() As Task Dim code = Class C @@ -1261,17 +1262,17 @@ Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "String", .AsFullName = "System.String", .CodeTypeFullName = "System.String", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefString }) - End Sub + End Function - Public Sub Type3() + Public Async Function TestType3() As Task Dim code = Class C @@ -1280,17 +1281,17 @@ Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "String", .AsFullName = "System.String", .CodeTypeFullName = "System.String", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefString }) - End Sub + End Function - Public Sub Type4() + Public Async Function TestType4() As Task Dim code = MustInherit Class C @@ -1298,21 +1299,21 @@ MustInherit Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "String", .AsFullName = "System.String", .CodeTypeFullName = "System.String", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefString }) - End Sub + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute_Sub() + Public Async Function TestAddAttribute_Sub() As Task Dim code = Imports System @@ -1333,11 +1334,11 @@ Class C End Sub End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_Function() + Public Async Function TestAddAttribute_Function() As Task Dim code = Imports System @@ -1358,11 +1359,11 @@ Class C End Function End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_Sub_MustOverride() + Public Async Function TestAddAttribute_Sub_MustOverride() As Task Dim code = Imports System @@ -1381,11 +1382,11 @@ MustInherit Class C MustOverride Sub M() End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_Function_MustOverride() + Public Async Function TestAddAttribute_Function_MustOverride() As Task Dim code = Imports System @@ -1404,11 +1405,11 @@ MustInherit Class C MustOverride Function M() As integer End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_DeclareSub() + Public Async Function TestAddAttribute_DeclareSub() As Task Dim code = Imports System @@ -1427,11 +1428,11 @@ Class C Declare Sub M() Lib "MyDll.dll" End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_DeclareFunction() + Public Async Function TestAddAttribute_DeclareFunction() As Task Dim code = Imports System @@ -1450,11 +1451,11 @@ Class C Declare Function M() Lib "MyDll.dll" As Integer End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_Constructor() + Public Async Function TestAddAttribute_Constructor() As Task Dim code = Imports System @@ -1475,11 +1476,11 @@ Class C End Sub End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_Operator() + Public Async Function TestAddAttribute_Operator() As Task Dim code = Imports System @@ -1500,11 +1501,11 @@ Class C End Operator End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_Conversion() + Public Async Function TestAddAttribute_Conversion() As Task Dim code = Imports System @@ -1525,12 +1526,12 @@ Class C End Operator End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_Sub_BelowDocComment() + Public Async Function TestAddAttribute_Sub_BelowDocComment() As Task Dim code = Imports System @@ -1553,12 +1554,12 @@ Class C End Sub End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_Function_BelowDocComment() + Public Async Function TestAddAttribute_Function_BelowDocComment() As Task Dim code = Imports System @@ -1581,12 +1582,12 @@ Class C End Function End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_Sub_MustOverride_BelowDocComment() + Public Async Function TestAddAttribute_Sub_MustOverride_BelowDocComment() As Task Dim code = Imports System @@ -1607,12 +1608,12 @@ MustInherit Class C MustOverride Sub M() End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_Function_MustOverride_BelowDocComment() + Public Async Function TestAddAttribute_Function_MustOverride_BelowDocComment() As Task Dim code = Imports System @@ -1633,12 +1634,12 @@ MustInherit Class C MustOverride Function M() As integer End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_DeclareSub_BelowDocComment() + Public Async Function TestAddAttribute_DeclareSub_BelowDocComment() As Task Dim code = Imports System @@ -1659,12 +1660,12 @@ Class C Declare Sub M() Lib "MyDll.dll" End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_DeclareFunction_BelowDocComment() + Public Async Function TestAddAttribute_DeclareFunction_BelowDocComment() As Task Dim code = Imports System @@ -1685,12 +1686,12 @@ Class C Declare Function M() Lib "MyDll.dll" As Integer End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_Constructor_BelowDocComment() + Public Async Function TestAddAttribute_Constructor_BelowDocComment() As Task Dim code = Imports System @@ -1713,12 +1714,12 @@ Class C End Sub End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_Operator_BelowDocComment() + Public Async Function TestAddAttribute_Operator_BelowDocComment() As Task Dim code = Imports System @@ -1741,12 +1742,12 @@ Class C End Operator End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_Conversion_BelowDocComment() + Public Async Function TestAddAttribute_Conversion_BelowDocComment() As Task Dim code = Imports System @@ -1769,15 +1770,15 @@ Class C End Operator End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function #End Region #Region "AddParameter tests" - Public Sub AddParameter1() + Public Async Function TestAddParameter1() As Task Dim code = Class C @@ -1794,11 +1795,11 @@ Class C End Class - TestAddParameter(code, expected, New ParameterData With {.Name = "a", .Type = "Integer"}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "a", .Type = "Integer"}) + End Function - Public Sub AddParameter2() + Public Async Function TestAddParameter2() As Task Dim code = Class C @@ -1815,11 +1816,11 @@ Class C End Class - TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "String"}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "String"}) + End Function - Public Sub AddParameter3() + Public Async Function TestAddParameter3() As Task Dim code = Class C @@ -1836,11 +1837,11 @@ Class C End Class - TestAddParameter(code, expected, New ParameterData With {.Name = "c", .Type = "System.Boolean", .Position = 1}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "c", .Type = "System.Boolean", .Position = 1}) + End Function - Public Sub AddParameter4() + Public Async Function TestAddParameter4() As Task Dim code = Class C @@ -1857,12 +1858,12 @@ Class C End Class - TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "String", .Position = -1}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "String", .Position = -1}) + End Function - Public Sub AddParameter_DeclareFunction() + Public Async Function TestAddParameter_DeclareFunction() As Task Dim code = Public Class C1 @@ -1875,12 +1876,12 @@ Public Class C1 Declare Function getUserName Lib "My1.dll" (a As Integer, b As String) As String End Class - TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "String", .Position = -1}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "String", .Position = -1}) + End Function - Public Sub AddParameter_DeclareSub() + Public Async Function TestAddParameter_DeclareSub() As Task Dim code = Public Class C1 @@ -1893,15 +1894,15 @@ Public Class C1 Declare Sub getUserName Lib "My1.dll" (a As Integer, b As String) End Class - TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "String", .Position = -1}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "b", .Type = "String", .Position = -1}) + End Function #End Region #Region "RemoveParameter tests" - Public Sub RemoveParameter1() + Public Async Function TestRemoveParameter1() As Task Dim code = Class C @@ -1918,11 +1919,11 @@ Class C End Class - TestRemoveChild(code, expected, "a") - End Sub + Await TestRemoveChild(code, expected, "a") + End Function - Public Sub RemoveParameter2() + Public Async Function TestRemoveParameter2() As Task Dim code = Class C @@ -1939,11 +1940,11 @@ Class C End Class - TestRemoveChild(code, expected, "b") - End Sub + Await TestRemoveChild(code, expected, "b") + End Function - Public Sub RemoveParameter3() + Public Async Function TestRemoveParameter3() As Task Dim code = Class C @@ -1960,11 +1961,11 @@ Class C End Class - TestRemoveChild(code, expected, "a") - End Sub + Await TestRemoveChild(code, expected, "a") + End Function - Public Sub RemoveParameter4() + Public Async Function TestRemoveParameter4() As Task Dim code = Class C @@ -1981,15 +1982,15 @@ Class C End Class - TestRemoveChild(code, expected, "b") - End Sub + Await TestRemoveChild(code, expected, "b") + End Function #End Region #Region "Set Access tests" - Public Sub SetAccess1() + Public Async Function TestSetAccess1() As Task Dim code = Class C @@ -2008,11 +2009,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetAccess2() + Public Async Function TestSetAccess2() As Task Dim code = Class C @@ -2031,11 +2032,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub SetAccess3() + Public Async Function TestSetAccess3() As Task Dim code = Class C @@ -2054,11 +2055,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetAccess4() + Public Async Function TestSetAccess4() As Task Dim code = Class C @@ -2077,11 +2078,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub SetAccess5() + Public Async Function TestSetAccess5() As Task Dim code = Class C @@ -2100,11 +2101,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetAccess6() + Public Async Function TestSetAccess6() As Task Dim code = Interface C @@ -2119,11 +2120,11 @@ Interface C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) + End Function - Public Sub SetAccess7() + Public Async Function TestSetAccess7() As Task Dim code = Interface C @@ -2138,15 +2139,15 @@ Interface C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function #End Region #Region "Set CanOverride tests" - Public Sub SetCanOverride1() + Public Async Function TestSetCanOverride1() As Task Dim code = MustInherit Class C @@ -2165,11 +2166,11 @@ MustInherit Class C End Class - TestSetCanOverride(code, expected, True) - End Sub + Await TestSetCanOverride(code, expected, True) + End Function - Public Sub SetCanOverride2() + Public Async Function TestSetCanOverride2() As Task Dim code = MustInherit Class C @@ -2188,11 +2189,11 @@ MustInherit Class C End Class - TestSetCanOverride(code, expected, False) - End Sub + Await TestSetCanOverride(code, expected, False) + End Function - Public Sub SetCanOverride3() + Public Async Function TestSetCanOverride3() As Task Dim code = MustInherit Class C @@ -2209,15 +2210,15 @@ MustInherit Class C End Class - TestSetCanOverride(code, expected, True) - End Sub + Await TestSetCanOverride(code, expected, True) + End Function #End Region #Region "Set MustImplement tests" - Public Sub SetMustImplement1() + Public Async Function TestSetMustImplement1() As Task Dim code = MustInherit Class C @@ -2234,11 +2235,11 @@ MustInherit Class C End Class - TestSetMustImplement(code, expected, True) - End Sub + Await TestSetMustImplement(code, expected, True) + End Function - Public Sub SetMustImplement2() + Public Async Function TestSetMustImplement2() As Task Dim code = MustInherit Class C @@ -2257,11 +2258,11 @@ MustInherit Class C End Class - TestSetMustImplement(code, expected, False) - End Sub + Await TestSetMustImplement(code, expected, False) + End Function - Public Sub SetMustImplement3() + Public Async Function TestSetMustImplement3() As Task Dim code = MustInherit Class C @@ -2276,15 +2277,15 @@ MustInherit Class C End Class - TestSetMustImplement(code, expected, True) - End Sub + Await TestSetMustImplement(code, expected, True) + End Function #End Region #Region "Set IsShared tests" - Public Sub SetIsShared1() + Public Async Function TestSetIsShared1() As Task Dim code = Class C @@ -2303,11 +2304,11 @@ Class C End Class - TestSetIsShared(code, expected, True) - End Sub + Await TestSetIsShared(code, expected, True) + End Function - Public Sub SetIsShared2() + Public Async Function TestSetIsShared2() As Task Dim code = Class C @@ -2326,15 +2327,15 @@ Class C End Class - TestSetIsShared(code, expected, False) - End Sub + Await TestSetIsShared(code, expected, False) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = Class C @@ -2351,15 +2352,15 @@ Class C End Class - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region #Region "Set OverrideKind tests" - Public Sub SetOverrideKind1() + Public Async Function TestSetOverrideKind1() As Task Dim code = MustInherit Class C @@ -2378,11 +2379,11 @@ MustInherit Class C End Class - TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNone) - End Sub + Await TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNone) + End Function - Public Sub SetOverrideKind2() + Public Async Function TestSetOverrideKind2() As Task Dim code = MustInherit Class C @@ -2399,11 +2400,11 @@ MustInherit Class C End Class - TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) - End Sub + Await TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) + End Function - Public Sub SetOverrideKind3() + Public Async Function TestSetOverrideKind3() As Task Dim code = MustInherit Class C @@ -2420,15 +2421,15 @@ MustInherit Class C End Class - TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNone) - End Sub + Await TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNone) + End Function #End Region #Region "Set Type tests" - Public Sub SetType1() + Public Async Function TestSetType1() As Task Dim code = Class C @@ -2447,11 +2448,11 @@ Class C End Class - TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) - End Sub + Await TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) + End Function - Public Sub SetType2() + Public Async Function TestSetType2() As Task Dim code = Class C @@ -2470,11 +2471,11 @@ Class C End Class - TestSetTypeProp(code, expected, "System.Int32") - End Sub + Await TestSetTypeProp(code, expected, "System.Int32") + End Function - Public Sub SetType3() + Public Async Function TestSetType3() As Task Dim code = Class C @@ -2493,11 +2494,11 @@ Class C End Class - TestSetTypeProp(code, expected, "System.String") - End Sub + Await TestSetTypeProp(code, expected, "System.String") + End Function - Public Sub SetType4() + Public Async Function TestSetType4() As Task Dim code = Class C @@ -2516,11 +2517,11 @@ Class C End Class - TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) - End Sub + Await TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) + End Function - Public Sub SetType5() + Public Async Function TestSetType5() As Task Dim code = MustInherit Class C @@ -2535,11 +2536,11 @@ MustInherit Class C End Class - TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) - End Sub + Await TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) + End Function - Public Sub SetType6() + Public Async Function TestSetType6() As Task Dim code = MustInherit Class C @@ -2554,11 +2555,11 @@ MustInherit Class C End Class - TestSetTypeProp(code, expected, "System.Int32") - End Sub + Await TestSetTypeProp(code, expected, "System.Int32") + End Function - Public Sub SetType7() + Public Async Function TestSetType7() As Task Dim code = Class C @@ -2575,11 +2576,11 @@ Class C End Class - TestSetTypeProp(code, expected, "System.Int32") - End Sub + Await TestSetTypeProp(code, expected, "System.Int32") + End Function - Public Sub SetType8() + Public Async Function TestSetType8() As Task Dim code = Class C @@ -2596,12 +2597,12 @@ Class C End Class - TestSetTypeProp(code, expected, "System.Int32") - End Sub + Await TestSetTypeProp(code, expected, "System.Int32") + End Function - Public Sub SetType_DeclareFunction() + Public Async Function TestSetType_DeclareFunction() As Task Dim code = Public Class C1 @@ -2614,12 +2615,12 @@ Public Class C1 Declare Function getUserName Lib "My1.dll" (a As Integer) As Integer End Class - TestSetTypeProp(code, expected, "System.Int32") - End Sub + Await TestSetTypeProp(code, expected, "System.Int32") + End Function - Public Sub SetType_DeclareFunctionToSub() + Public Async Function TestSetType_DeclareFunctionToSub() As Task Dim code = Public Class C1 @@ -2633,12 +2634,12 @@ Public Class C1 End Class - TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) - End Sub + Await TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) + End Function - Public Sub SetType_DeclareSubToFunction() + Public Async Function TestSetType_DeclareSubToFunction() As Task Dim code = Public Class C1 @@ -2653,15 +2654,15 @@ End Class - TestSetTypeProp(code, expected, "System.Int32") - End Sub + Await TestSetTypeProp(code, expected, "System.Int32") + End Function #End Region #Region "PartialMethodExtender" - Public Sub PartialMethodExtender_IsPartial1() + Public Async Function TestPartialMethodExtender_IsPartial1() As Task Dim code = Partial Public Class Class2 @@ -2676,11 +2677,11 @@ Partial Public Class Class2 End Class - TestPartialMethodExtender_IsPartial(code, False) - End Sub + Await TestPartialMethodExtender_IsPartial(code, False) + End Function - Public Sub PartialMethodExtender_IsPartial2() + Public Async Function TestPartialMethodExtender_IsPartial2() As Task Dim code = Partial Public Class Class2 @@ -2695,11 +2696,11 @@ Partial Public Class Class2 End Class - TestPartialMethodExtender_IsPartial(code, True) - End Sub + Await TestPartialMethodExtender_IsPartial(code, True) + End Function - Public Sub PartialMethodExtender_IsPartial3() + Public Async Function TestPartialMethodExtender_IsPartial3() As Task Dim code = Partial Public Class Class2 @@ -2714,11 +2715,11 @@ Partial Public Class Class2 End Class - TestPartialMethodExtender_IsPartial(code, True) - End Sub + Await TestPartialMethodExtender_IsPartial(code, True) + End Function - Public Sub PartialMethodExtender_IsDeclaration1() + Public Async Function TestPartialMethodExtender_IsDeclaration1() As Task Dim code = Partial Public Class Class2 @@ -2733,11 +2734,11 @@ Partial Public Class Class2 End Class - TestPartialMethodExtender_IsDeclaration(code, False) - End Sub + Await TestPartialMethodExtender_IsDeclaration(code, False) + End Function - Public Sub PartialMethodExtender_IsDeclaration2() + Public Async Function TestPartialMethodExtender_IsDeclaration2() As Task Dim code = Partial Public Class Class2 @@ -2752,11 +2753,11 @@ Partial Public Class Class2 End Class - TestPartialMethodExtender_IsDeclaration(code, True) - End Sub + Await TestPartialMethodExtender_IsDeclaration(code, True) + End Function - Public Sub PartialMethodExtender_IsDeclaration3() + Public Async Function TestPartialMethodExtender_IsDeclaration3() As Task Dim code = Partial Public Class Class2 @@ -2771,15 +2772,15 @@ Partial Public Class Class2 End Class - TestPartialMethodExtender_IsDeclaration(code, False) - End Sub + Await TestPartialMethodExtender_IsDeclaration(code, False) + End Function #End Region #Region "Overloads Tests" - Public Sub IsOverloaded1() + Public Async Function TestIsOverloaded1() As Task Dim code = Class C @@ -2787,11 +2788,11 @@ Class C End Sub End Class - TestIsOverloaded(code, False) - End Sub + Await TestIsOverloaded(code, False) + End Function - Public Sub IsOverloaded2() + Public Async Function TestIsOverloaded2() As Task Dim code = Class C @@ -2802,11 +2803,11 @@ Class C End Sub End Class - TestIsOverloaded(code, True) - End Sub + Await TestIsOverloaded(code, True) + End Function - Public Sub TestOverloads1() + Public Async Function TestOverloads1() As Task Dim code = Class C @@ -2818,11 +2819,11 @@ Class C End Class - TestOverloadsUniqueSignatures(code, "M:C.Foo", "M:C.Foo(C)") - End Sub + Await TestOverloadsUniqueSignatures(code, "M:C.Foo", "M:C.Foo(C)") + End Function - Public Sub TestOverloads2() + Public Async Function TestOverloads2() As Task Dim code = Class C @@ -2831,11 +2832,11 @@ Class C End Class - TestOverloadsUniqueSignatures(code, "M:C.Foo") - End Sub + Await TestOverloadsUniqueSignatures(code, "M:C.Foo") + End Function - Public Sub TestOverloads3() + Public Async Function TestOverloads3() As Task Dim code = Class C @@ -2843,8 +2844,8 @@ Class C End Operator End Class - TestOverloadsUniqueSignatures(code, "M:C.op_Multiply(System.Int32,C)") - End Sub + Await TestOverloadsUniqueSignatures(code, "M:C.op_Multiply(System.Int32,C)") + End Function #End Region @@ -2852,7 +2853,7 @@ End Class - Public Sub TestParameterNameWithEscapeCharacters() + Public Async Function TestParameterNameWithEscapeCharacters() As Task Dim code = Class C @@ -2860,12 +2861,12 @@ Class C End Sub End Class - TestAllParameterNames(code, "[integer]") - End Sub + Await TestAllParameterNames(code, "[integer]") + End Function - Public Sub TestParameterNameWithEscapeCharacters_2() + Public Async Function TestParameterNameWithEscapeCharacters_2() As Task Dim code = Class C @@ -2873,8 +2874,8 @@ Class C End Sub End Class - TestAllParameterNames(code, "[integer]", "[string]") - End Sub + Await TestAllParameterNames(code, "[integer]", "[string]") + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeImportTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeImportTests.vb index 18bbc56ab1a2fa57b60c34b6005ddfa4586dc814..dbef01c57597a2a54365b34f60051525abe7db96 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeImportTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeImportTests.vb @@ -1,6 +1,7 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. Imports System.Runtime.InteropServices +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Text Imports Roslyn.Test.Utilities @@ -12,13 +13,13 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "GetStartPoint() tests" - Public Sub GetStartPoint1() + Public Async Function TestGetStartPoint1() As Task Dim code = Imports $$System - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -39,16 +40,16 @@ Imports $$System TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=14)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=14))) - End Sub + End Function - Public Sub GetStartPoint2() + Public Async Function TestGetStartPoint2() As Task Dim code = Imports System, $$System.Linq - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -69,16 +70,16 @@ Imports System, $$System.Linq TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=27)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=27))) - End Sub + End Function - Public Sub GetStartPoint3() + Public Async Function TestGetStartPoint3() As Task Dim code = Imports System, $$S = System.Linq - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -99,20 +100,20 @@ Imports System, $$S = System.Linq TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=31))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint1() + Public Async Function TestGetEndPoint1() As Task Dim code = Imports $$System - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -133,16 +134,16 @@ Imports $$System TextPoint(line:=1, lineOffset:=15, absoluteOffset:=15, lineLength:=14)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=15, absoluteOffset:=15, lineLength:=14))) - End Sub + End Function - Public Sub GetEndPoint2() + Public Async Function TestGetEndPoint2() As Task Dim code = Imports System, $$System.Linq - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -163,16 +164,16 @@ Imports System, $$System.Linq TextPoint(line:=1, lineOffset:=28, absoluteOffset:=28, lineLength:=27)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=28, absoluteOffset:=28, lineLength:=27))) - End Sub + End Function - Public Sub GetEndPoint3() + Public Async Function TestGetEndPoint3() As Task Dim code = Imports System, $$S = System.Linq - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -193,61 +194,61 @@ Imports System, $$S = System.Linq TextPoint(line:=1, lineOffset:=32, absoluteOffset:=32, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=32, absoluteOffset:=32, lineLength:=31))) - End Sub + End Function #End Region #Region "FullName tests" - Public Sub FullName1() + Public Async Function TestFullName1() As Task Dim code = Imports $$System - Assert.Throws(Of NotImplementedException)( - Sub() - TestFullName(code, "System") - End Sub) - End Sub + Await Assert.ThrowsAsync(Of NotImplementedException)( + Async Function() + Await TestFullName(code, "System") + End Function) + End Function #End Region #Region "Name tests" - Public Sub Name1() + Public Async Function TestName1() As Task Dim code = Imports $$Foo - TestName(code, "Foo") - End Sub + Await TestName(code, "Foo") + End Function - Public Sub Name2() + Public Async Function TestName2() As Task Dim code = Imports System$$, System.Linq - TestName(code, "System") - End Sub + Await TestName(code, "System") + End Function - Public Sub Name3() + Public Async Function TestName3() As Task Dim code = Imports System, System.Linq$$ - TestName(code, "System.Linq") - End Sub + Await TestName(code, "System.Linq") + End Function - Public Sub Name4() + Public Async Function TestName4() As Task Dim code = Imports System _ @@ -255,35 +256,35 @@ Imports System _ Linq$$ - TestName(code, "System.Linq") - End Sub + Await TestName(code, "System.Linq") + End Function - Public Sub Name5() + Public Async Function TestName5() As Task Dim code = Imports System, S = System.Linq$$ - TestName(code, "System.Linq") - End Sub + Await TestName(code, "System.Linq") + End Function #End Region #Region "Namespace tests" - Public Sub Namespace1() + Public Async Function TestNamespace1() As Task Dim code = Imports $$Foo - TestNamespace(code, "Foo") - End Sub + Await TestNamespace(code, "Foo") + End Function - Public Sub Namespace2() + Public Async Function TestNamespace2() As Task Dim code = Imports System _ @@ -291,8 +292,8 @@ Imports System _ Linq$$ - TestNamespace(code, "System.Linq") - End Sub + Await TestNamespace(code, "System.Linq") + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeInterfaceTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeInterfaceTests.vb index 97d03a4cf8f8a34411a16d1c21c66f11443a60c0..85cf38c0bda5656f6e3ddfd2424fb131120db46e 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeInterfaceTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeInterfaceTests.vb @@ -1,6 +1,7 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. Imports System.Runtime.InteropServices +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.CodeModel.Extenders Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.CodeModel.Interop @@ -13,62 +14,62 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "Access tests" - Public Sub Access1() + Public Async Function TestAccess1() As Task Dim code = Interface $$I : End Interface - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access2() + Public Async Function TestAccess2() As Task Dim code = Friend Interface $$I : End Interface - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access3() + Public Async Function TestAccess3() As Task Dim code = Public Interface $$I : End Interface - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function #End Region #Region "Parts tests" - Public Sub Parts1() + Public Async Function TestParts1() As Task Dim code = Interface $$I End Interface - TestParts(code, 1) - End Sub + Await TestParts(code, 1) + End Function - Public Sub Parts2() + Public Async Function TestParts2() As Task Dim code = Partial Interface $$I End Interface - TestParts(code, 1) - End Sub + Await TestParts(code, 1) + End Function - Public Sub Parts3() + Public Async Function TestParts3() As Task Dim code = Partial Interface $$I @@ -78,14 +79,14 @@ Partial Interface I End Interface - TestParts(code, 2) - End Sub + Await TestParts(code, 2) + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = Imports System @@ -102,11 +103,11 @@ Imports System Interface I End Interface - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = Imports System @@ -125,12 +126,12 @@ Imports System Interface I End Interface - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment() + Public Async Function TestAddAttribute_BelowDocComment() As Task Dim code = Imports System @@ -149,15 +150,15 @@ Imports System Interface I End Interface - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True"}) + End Function #End Region #Region "AddBase tests" - Public Sub AddBase1() + Public Async Function TestAddBase1() As Task Dim code = Interface $$I @@ -176,11 +177,11 @@ End Interface Interface J End Interface - TestAddBase(code, "J", Nothing, expected) - End Sub + Await TestAddBase(code, "J", Nothing, expected) + End Function - Public Sub AddBase2() + Public Async Function TestAddBase2() As Task Dim code = Interface $$I @@ -201,15 +202,15 @@ End Interface Interface K End Interface - TestAddBase(code, "K", Nothing, expected) - End Sub + Await TestAddBase(code, "K", Nothing, expected) + End Function #End Region #Region "RemoveBase tests" - Public Sub RemoveBase1() + Public Async Function TestRemoveBase1() As Task Dim code = Interface $$I @@ -222,22 +223,22 @@ End Interface Interface I End Interface - TestRemoveBase(code, "J", expected) - End Sub + Await TestRemoveBase(code, "J", expected) + End Function - Public Sub RemoveBase2() + Public Async Function TestRemoveBase2() As Task Dim code = Interface $$I End Interface - TestRemoveBaseThrows(Of COMException)(code, "J") - End Sub + Await TestRemoveBaseThrows(Of COMException)(code, "J") + End Function - Public Sub RemoveBase3() + Public Async Function TestRemoveBase3() As Task Dim code = Interface $$I @@ -251,11 +252,11 @@ Interface I Inherits J End Interface - TestRemoveBase(code, "K", expected) - End Sub + Await TestRemoveBase(code, "K", expected) + End Function - Public Sub RemoveBase4() + Public Async Function TestRemoveBase4() As Task Dim code = Interface $$I @@ -269,15 +270,15 @@ Interface I Inherits K End Interface - TestRemoveBase(code, "J", expected) - End Sub + Await TestRemoveBase(code, "J", expected) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = Interface $$Foo @@ -290,25 +291,25 @@ Interface Bar End Interface - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region #Region "GenericExtender" - Public Sub GenericExtender_GetBaseTypesCount1() + Public Async Function TestGenericExtender_GetBaseTypesCount1() As Task Dim code = Interface I$$ End Interface - TestGenericNameExtender_GetBaseTypesCount(code, 0) - End Sub + Await TestGenericNameExtender_GetBaseTypesCount(code, 0) + End Function - Public Sub GenericExtender_GetBaseTypesCount2() + Public Async Function TestGenericExtender_GetBaseTypesCount2() As Task Dim code = Namespace N @@ -325,22 +326,22 @@ Namespace N End Namespace - TestGenericNameExtender_GetBaseTypesCount(code, 1) - End Sub + Await TestGenericNameExtender_GetBaseTypesCount(code, 1) + End Function - Public Sub GenericExtender_GetBaseGenericName1() + Public Async Function TestGenericExtender_GetBaseGenericName1() As Task Dim code = Interface I$$ End Interface - TestGenericNameExtender_GetBaseGenericName(code, 1, Nothing) - End Sub + Await TestGenericNameExtender_GetBaseGenericName(code, 1, Nothing) + End Function - Public Sub GenericExtender_GetBaseGenericName2() + Public Async Function TestGenericExtender_GetBaseGenericName2() As Task Dim code = Namespace N @@ -357,22 +358,22 @@ Namespace N End Namespace - TestGenericNameExtender_GetBaseGenericName(code, 1, "N.IFoo(Of Integer)") - End Sub + Await TestGenericNameExtender_GetBaseGenericName(code, 1, "N.IFoo(Of Integer)") + End Function - Public Sub GenericExtender_GetImplementedTypesCount1() + Public Async Function TestGenericExtender_GetImplementedTypesCount1() As Task Dim code = Interface I$$ End Interface - TestGenericNameExtender_GetImplementedTypesCountThrows(Of ArgumentException)(code) - End Sub + Await TestGenericNameExtender_GetImplementedTypesCountThrows(Of ArgumentException)(code) + End Function - Public Sub GenericExtender_GetImplementedTypesCount2() + Public Async Function TestGenericExtender_GetImplementedTypesCount2() As Task Dim code = Namespace N @@ -389,22 +390,22 @@ Namespace N End Namespace - TestGenericNameExtender_GetImplementedTypesCountThrows(Of ArgumentException)(code) - End Sub + Await TestGenericNameExtender_GetImplementedTypesCountThrows(Of ArgumentException)(code) + End Function - Public Sub GenericExtender_GetImplTypeGenericName1() + Public Async Function TestGenericExtender_GetImplTypeGenericName1() As Task Dim code = Interface I$$ End Interface - TestGenericNameExtender_GetImplTypeGenericNameThrows(Of ArgumentException)(code, 1) - End Sub + Await TestGenericNameExtender_GetImplTypeGenericNameThrows(Of ArgumentException)(code, 1) + End Function - Public Sub GenericExtender_GetImplTypeGenericName2() + Public Async Function TestGenericExtender_GetImplTypeGenericName2() As Task Dim code = Namespace N @@ -421,8 +422,8 @@ Namespace N End Namespace - TestGenericNameExtender_GetImplTypeGenericNameThrows(Of ArgumentException)(code, 1) - End Sub + Await TestGenericNameExtender_GetImplTypeGenericNameThrows(Of ArgumentException)(code, 1) + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeNamespaceTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeNamespaceTests.vb index 394741db26229096eb6bc419179a862bfd93ab15..e763357c45d1927c707ae87cf76e014a159947db 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeNamespaceTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeNamespaceTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -11,13 +12,13 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "GetStartPoint() tests" - Public Sub GetStartPoint1() + Public Async Function TestGetStartPoint1() As Task Dim code = Namespace $$N : End Namespace - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -38,17 +39,17 @@ Namespace $$N : End Namespace TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=27)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=27))) - End Sub + End Function - Public Sub GetStartPoint2() + Public Async Function TestGetStartPoint2() As Task Dim code = Namespace $$N : End Namespace - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -69,17 +70,17 @@ End Namespace TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=13)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=13))) - End Sub + End Function - Public Sub GetStartPoint3() + Public Async Function TestGetStartPoint3() As Task Dim code = Namespace $$N ' N End Namespace - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -100,17 +101,17 @@ End Namespace TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=15)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=15))) - End Sub + End Function - Public Sub GetStartPoint4() + Public Async Function TestGetStartPoint4() As Task Dim code = Namespace $$N End Namespace - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -131,10 +132,10 @@ End Namespace TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=11)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=11))) - End Sub + End Function - Public Sub GetStartPoint5() + Public Async Function TestGetStartPoint5() As Task Dim code = Namespace $$N @@ -144,7 +145,7 @@ End Namespace ' Note: TextPoint.AbsoluteCharOffset throws in VS 2012 for vsCMPartNavigate - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -165,10 +166,10 @@ End Namespace TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=11)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=11))) - End Sub + End Function - Public Sub GetStartPoint6() + Public Async Function TestGetStartPoint6() As Task Dim code = Namespace $$N @@ -177,7 +178,7 @@ Namespace $$N End Namespace - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -198,10 +199,10 @@ End Namespace TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=11)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=11))) - End Sub + End Function - Public Sub GetStartPoint7() + Public Async Function TestGetStartPoint7() As Task Dim code = Namespace $$N @@ -214,7 +215,7 @@ End Namespace ' Note: TextPoint.AbsoluteCharOffset throws in VS 2012 for vsCMPartNavigate - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -235,20 +236,20 @@ End Namespace TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=11)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=11))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint1() + Public Async Function TestGetEndPoint1() As Task Dim code = Namespace $$N : End Namespace - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -269,17 +270,17 @@ Namespace $$N : End Namespace TextPoint(line:=1, lineOffset:=28, absoluteOffset:=28, lineLength:=27)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=28, absoluteOffset:=28, lineLength:=27))) - End Sub + End Function - Public Sub GetEndPoint2() + Public Async Function TestGetEndPoint2() As Task Dim code = Namespace $$N End Namespace - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -300,10 +301,10 @@ End Namespace TextPoint(line:=2, lineOffset:=14, absoluteOffset:=26, lineLength:=13)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=14, absoluteOffset:=26, lineLength:=13))) - End Sub + End Function - Public Sub GetEndPoint3() + Public Async Function TestGetEndPoint3() As Task Dim code = Namespace $$N @@ -311,7 +312,7 @@ Namespace $$N End Namespace - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -332,10 +333,10 @@ End Namespace TextPoint(line:=3, lineOffset:=14, absoluteOffset:=27, lineLength:=13)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=14, absoluteOffset:=27, lineLength:=13))) - End Sub + End Function - Public Sub GetEndPoint4() + Public Async Function TestGetEndPoint4() As Task Dim code = Namespace $$N @@ -344,7 +345,7 @@ Namespace $$N End Namespace - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -365,10 +366,10 @@ End Namespace TextPoint(line:=4, lineOffset:=14, absoluteOffset:=52, lineLength:=13)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=4, lineOffset:=14, absoluteOffset:=52, lineLength:=13))) - End Sub + End Function - Public Sub GetEndPoint5() + Public Async Function TestGetEndPoint5() As Task Dim code = Namespace $$N @@ -379,7 +380,7 @@ Namespace $$N End Namespace - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -400,14 +401,14 @@ End Namespace TextPoint(line:=6, lineOffset:=14, absoluteOffset:=54, lineLength:=13)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=6, lineOffset:=14, absoluteOffset:=54, lineLength:=13))) - End Sub + End Function #End Region #Region "Remove tests" - Public Sub Remove1() + Public Async Function TestRemove1() As Task Dim code = Namespace $$Foo @@ -422,14 +423,14 @@ Namespace Foo End Namespace - TestRemoveChild(code, expected, "C") - End Sub + Await TestRemoveChild(code, expected, "C") + End Function #End Region - Public Sub Children1() + Public Async Function TestChildren1() As Task Dim code = Namespace N$$ @@ -444,11 +445,11 @@ Namespace N$$ End Namespace - TestChildren(code, + Await TestChildren(code, IsElement("C1", EnvDTE.vsCMElement.vsCMElementClass), IsElement("C2", EnvDTE.vsCMElement.vsCMElementClass), IsElement("C3", EnvDTE.vsCMElement.vsCMElementClass)) - End Sub + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeParameterTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeParameterTests.vb index d1c93b72e8646e44da4db27246448937b3764e6b..6a4198c1873782131fdf0d00be9236bdadf9afe1 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeParameterTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeParameterTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,7 +11,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "GetStartPoint() tests" - Public Sub GetStartPoint_NoModifiers() + Public Async Function TestGetStartPoint_NoModifiers() As Task Dim code = Public Class C1 @@ -21,7 +22,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -42,10 +43,10 @@ End Class TextPoint(line:=3, lineOffset:=18, absoluteOffset:=35, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=18, absoluteOffset:=35, lineLength:=31))) - End Sub + End Function - Public Sub GetStartPoint_ByValModifier() + Public Async Function TestGetStartPoint_ByValModifier() As Task Dim code = Public Class C1 @@ -56,7 +57,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -77,10 +78,10 @@ End Class TextPoint(line:=3, lineOffset:=18, absoluteOffset:=35, lineLength:=37)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=18, absoluteOffset:=35, lineLength:=37))) - End Sub + End Function - Public Sub GetStartPoint_ByRefModifier() + Public Async Function TestGetStartPoint_ByRefModifier() As Task Dim code = Public Class C1 @@ -91,7 +92,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -112,10 +113,10 @@ End Class TextPoint(line:=3, lineOffset:=18, absoluteOffset:=35, lineLength:=37)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=18, absoluteOffset:=35, lineLength:=37))) - End Sub + End Function - Public Sub GetStartPoint_OptionalByValModifiers() + Public Async Function TestGetStartPoint_OptionalByValModifiers() As Task Dim code = Public Class C1 @@ -126,7 +127,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -147,10 +148,10 @@ End Class TextPoint(line:=3, lineOffset:=18, absoluteOffset:=35, lineLength:=50)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=18, absoluteOffset:=35, lineLength:=50))) - End Sub + End Function - Public Sub GetStartPoint_ByValParamArrayModifiers() + Public Async Function TestGetStartPoint_ByValParamArrayModifiers() As Task Dim code = Public Class C1 @@ -161,7 +162,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -182,10 +183,10 @@ End Class TextPoint(line:=3, lineOffset:=18, absoluteOffset:=35, lineLength:=50)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=18, absoluteOffset:=35, lineLength:=50))) - End Sub + End Function - Public Sub GetStartPoint_TypeCharacter() + Public Async Function TestGetStartPoint_TypeCharacter() As Task Dim code = Public Class C1 @@ -196,7 +197,7 @@ Public Class C1 End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -217,14 +218,14 @@ End Class TextPoint(line:=3, lineOffset:=18, absoluteOffset:=35, lineLength:=21)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=18, absoluteOffset:=35, lineLength:=21))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint_NoModifiers() + Public Async Function TestGetEndPoint_NoModifiers() As Task Dim code = Public Class C1 @@ -235,7 +236,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -256,10 +257,10 @@ End Class TextPoint(line:=3, lineOffset:=31, absoluteOffset:=48, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=31, absoluteOffset:=48, lineLength:=31))) - End Sub + End Function - Public Sub GetEndPoint_ByValModifier() + Public Async Function TestGetEndPoint_ByValModifier() As Task Dim code = Public Class C1 @@ -270,7 +271,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -291,10 +292,10 @@ End Class TextPoint(line:=3, lineOffset:=37, absoluteOffset:=54, lineLength:=37)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=37, absoluteOffset:=54, lineLength:=37))) - End Sub + End Function - Public Sub GetEndPoint_ByRefModifier() + Public Async Function TestGetEndPoint_ByRefModifier() As Task Dim code = Public Class C1 @@ -305,7 +306,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -326,10 +327,10 @@ End Class TextPoint(line:=3, lineOffset:=37, absoluteOffset:=54, lineLength:=37)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=37, absoluteOffset:=54, lineLength:=37))) - End Sub + End Function - Public Sub GetEndPoint_OptionalByValModifiers() + Public Async Function TestGetEndPoint_OptionalByValModifiers() As Task Dim code = Public Class C1 @@ -340,7 +341,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -361,10 +362,10 @@ End Class TextPoint(line:=3, lineOffset:=50, absoluteOffset:=67, lineLength:=50)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=50, absoluteOffset:=67, lineLength:=50))) - End Sub + End Function - Public Sub GetEndPoint_ByValParamArrayModifiers() + Public Async Function TestGetEndPoint_ByValParamArrayModifiers() As Task Dim code = Public Class C1 @@ -375,7 +376,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -396,10 +397,10 @@ End Class TextPoint(line:=3, lineOffset:=50, absoluteOffset:=67, lineLength:=50)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=50, absoluteOffset:=67, lineLength:=50))) - End Sub + End Function - Public Sub GetEndPoint_TypeCharacter() + Public Async Function TestGetEndPoint_TypeCharacter() As Task Dim code = Public Class C1 @@ -410,7 +411,7 @@ Public Class C1 End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -431,14 +432,14 @@ End Class TextPoint(line:=3, lineOffset:=21, absoluteOffset:=38, lineLength:=21)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=21, absoluteOffset:=38, lineLength:=21))) - End Sub + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = - TestAddAttribute(code, expected, New AttributeData With {.Name = "Out"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Out"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = - TestAddAttribute(code, expected, New AttributeData With {.Name = "Foo"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Foo"}) + End Function - Public Sub AddAttribute3() + Public Async Function TestAddAttribute3() As Task Dim code = - TestAddAttribute(code, expected, New AttributeData With {.Name = "Out"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Out"}) + End Function #End Region #Region "FullName tests" - Public Sub FullName_NoModifiers() + Public Async Function TestFullName_NoModifiers() As Task Dim code = Class C @@ -513,11 +514,11 @@ Class C End Class - TestFullName(code, "s") - End Sub + Await TestFullName(code, "s") + End Function - Public Sub FullName_Array() + Public Async Function TestFullName_Array() As Task Dim code = Class C @@ -526,11 +527,11 @@ Class C End Class - TestFullName(code, "s()") - End Sub + Await TestFullName(code, "s()") + End Function - Public Sub FullName_TypeCharacter() + Public Async Function TestFullName_TypeCharacter() As Task Dim code = Class C @@ -539,15 +540,15 @@ Class C End Class - TestFullName(code, "s%") - End Sub + Await TestFullName(code, "s%") + End Function #End Region #Region "Name tests" - Public Sub Name_NoModifiers() + Public Async Function TestName_NoModifiers() As Task Dim code = Public Class C1 @@ -558,11 +559,11 @@ Public Class C1 End Class - TestName(code, "p1") - End Sub + Await TestName(code, "p1") + End Function - Public Sub Name_ByValModifier() + Public Async Function TestName_ByValModifier() As Task Dim code = Public Class C1 @@ -573,11 +574,11 @@ Public Class C1 End Class - TestName(code, "p2") - End Sub + Await TestName(code, "p2") + End Function - Public Sub Name_ByRefModifier() + Public Async Function TestName_ByRefModifier() As Task Dim code = Public Class C1 @@ -588,11 +589,11 @@ Public Class C1 End Class - TestName(code, "p3") - End Sub + Await TestName(code, "p3") + End Function - Public Sub Name_OptionalByValModifiers() + Public Async Function TestName_OptionalByValModifiers() As Task Dim code = Public Class C1 @@ -603,11 +604,11 @@ Public Class C1 End Class - TestName(code, "p4") - End Sub + Await TestName(code, "p4") + End Function - Public Sub Name_ByValParamArrayModifiers() + Public Async Function TestName_ByValParamArrayModifiers() As Task Dim code = Public Class C1 @@ -618,11 +619,11 @@ Public Class C1 End Class - TestName(code, "p5") - End Sub + Await TestName(code, "p5") + End Function - Public Sub Name_TypeCharacter() + Public Async Function TestName_TypeCharacter() As Task Dim code = Public Class C1 @@ -633,15 +634,15 @@ Public Class C1 End Class - TestName(code, "p6") - End Sub + Await TestName(code, "p6") + End Function #End Region #Region "Kind tests" - Public Sub Kind() + Public Async Function TestKind1() As Task Dim code = Class C @@ -650,15 +651,15 @@ Class C End Class - TestKind(code, EnvDTE.vsCMElement.vsCMElementParameter) - End Sub + Await TestKind(code, EnvDTE.vsCMElement.vsCMElementParameter) + End Function #End Region #Region "ParameterKind tests" - Public Sub ParameterKind_In() + Public Async Function TestParameterKind_In() As Task Dim code = Class C @@ -667,11 +668,11 @@ Class C End Class - TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindIn) - End Sub + Await TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindIn) + End Function - Public Sub ParameterKind_Ref() + Public Async Function TestParameterKind_Ref() As Task Dim code = Class C @@ -680,12 +681,12 @@ Class C End Class - TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindRef) - End Sub + Await TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindRef) + End Function - Public Sub ParameterKind_ParamArray() + Public Async Function TestParameterKind_ParamArray() As Task Dim code = Class C @@ -694,11 +695,11 @@ Class C End Class - TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindParamArray Or EnvDTE80.vsCMParameterKind.vsCMParameterKindIn) - End Sub + Await TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindParamArray Or EnvDTE80.vsCMParameterKind.vsCMParameterKindIn) + End Function - Public Sub ParameterKind_Optional() + Public Async Function TestParameterKind_Optional() As Task Dim code = Class C @@ -707,11 +708,11 @@ Class C End Class - TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional Or EnvDTE80.vsCMParameterKind.vsCMParameterKindIn) - End Sub + Await TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional Or EnvDTE80.vsCMParameterKind.vsCMParameterKindIn) + End Function - Public Sub ParameterKind_OptionalAndRef() + Public Async Function TestParameterKind_OptionalAndRef() As Task Dim code = Class C @@ -720,15 +721,15 @@ Class C End Class - TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional Or EnvDTE80.vsCMParameterKind.vsCMParameterKindRef) - End Sub + Await TestParameterKind(code, EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional Or EnvDTE80.vsCMParameterKind.vsCMParameterKindRef) + End Function #End Region #Region "Parent tests" - Public Sub Parent() + Public Async Function TestParent1() As Task Dim code = Class C @@ -737,15 +738,15 @@ Class C End Class - TestParent(code, IsElement("M", kind:=EnvDTE.vsCMElement.vsCMElementFunction)) - End Sub + Await TestParent(code, IsElement("M", kind:=EnvDTE.vsCMElement.vsCMElementFunction)) + End Function #End Region #Region "Type tests" - Public Sub Type1() + Public Async Function TestType1() As Task Dim code = Class C @@ -753,17 +754,17 @@ Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "Integer", .AsFullName = "System.Int32", .CodeTypeFullName = "System.Int32", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefInt }) - End Sub + End Function - Public Sub Type2() + Public Async Function TestType2() As Task Dim code = Class C @@ -771,21 +772,21 @@ Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "String", .AsFullName = "System.String", .CodeTypeFullName = "System.String", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefString }) - End Sub + End Function #End Region #Region "DefaultValue tests" - Public Sub DefaultValue() + Public Async Function TestDefaultValue1() As Task Dim code = Class C @@ -794,15 +795,15 @@ Class C End Class - TestDefaultValue(code, """Foo""") - End Sub + Await TestDefaultValue(code, """Foo""") + End Function #End Region #Region "Set ParameterKind tests" - Public Sub SetParameterKind_In() + Public Async Function TestSetParameterKind_In() As Task Dim code = Class C @@ -818,11 +819,11 @@ Class C End Sub End Class - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindIn) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindIn) + End Function - Public Sub SetParameterKind_None() + Public Async Function TestSetParameterKind_None() As Task Dim code = Class C @@ -838,11 +839,11 @@ Class C End Sub End Class - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindNone) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindNone) + End Function - Public Sub SetParameterKind_Out() + Public Async Function TestSetParameterKind_Out() As Task Dim code = Class C @@ -858,11 +859,11 @@ Class C End Sub End Class - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindOut, ThrowsArgumentException(Of EnvDTE80.vsCMParameterKind)()) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindOut, ThrowsArgumentException(Of EnvDTE80.vsCMParameterKind)()) + End Function - Public Sub SetParameterKind_Ref() + Public Async Function TestSetParameterKind_Ref() As Task Dim code = Class C @@ -878,11 +879,11 @@ Class C End Sub End Class - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindRef) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindRef) + End Function - Public Sub SetParameterKind_Params() + Public Async Function TestSetParameterKind_Params() As Task Dim code = Class C @@ -898,11 +899,11 @@ Class C End Sub End Class - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindParamArray) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindParamArray) + End Function - Public Sub SetParameterKind_Optional() + Public Async Function TestSetParameterKind_Optional() As Task Dim code = Class C @@ -918,11 +919,11 @@ Class C End Sub End Class - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional) + End Function - Public Sub SetParameterKind_Same() + Public Async Function TestSetParameterKind_Same() As Task Dim code = Class C @@ -938,11 +939,11 @@ Class C End Sub End Class - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindRef) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindRef) + End Function - Public Sub SetParameterKind_OptionalByref() + Public Async Function TestSetParameterKind_OptionalByref() As Task Dim code = Class C @@ -958,15 +959,15 @@ Class C End Sub End Class - TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindRef Or EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional) - End Sub + Await TestSetParameterKind(code, expected, EnvDTE80.vsCMParameterKind.vsCMParameterKindRef Or EnvDTE80.vsCMParameterKind.vsCMParameterKindOptional) + End Function #End Region #Region "Set DefaultValue tests" - Public Sub SetDefaultValue() + Public Async Function TestSetDefaultValue1() As Task Dim code = Class C @@ -982,11 +983,11 @@ Class C End Sub End Class - TestSetDefaultValue(code, expected, """Foo""") - End Sub + Await TestSetDefaultValue(code, expected, """Foo""") + End Function - Public Sub SetDefaultValue_ReplaceExisting() + Public Async Function TestSetDefaultValue_ReplaceExisting() As Task Dim code = Class C @@ -1002,11 +1003,11 @@ Class C End Sub End Class - TestSetDefaultValue(code, expected, """Foo""") - End Sub + Await TestSetDefaultValue(code, expected, """Foo""") + End Function - Public Sub SetDefaultValue_None() + Public Async Function TestSetDefaultValue_None() As Task Dim code = Class C @@ -1022,11 +1023,11 @@ Class C End Sub End Class - TestSetDefaultValue(code, expected, "") - End Sub + Await TestSetDefaultValue(code, expected, "") + End Function - Public Sub SetDefaultValue_OptionalMissing() + Public Async Function TestSetDefaultValue_OptionalMissing() As Task Dim code = Class C @@ -1042,15 +1043,15 @@ Class C End Sub End Class - TestSetDefaultValue(code, expected, """Foo""", ThrowsArgumentException(Of String)()) - End Sub + Await TestSetDefaultValue(code, expected, """Foo""", ThrowsArgumentException(Of String)()) + End Function #End Region #Region "Set Type tests" - Public Sub SetType1() + Public Async Function TestSetType1() As Task Dim code = Class C @@ -1067,11 +1068,11 @@ Class C End Class - TestSetTypeProp(code, expected, "Byte?(,)") - End Sub + Await TestSetTypeProp(code, expected, "Byte?(,)") + End Function - Public Sub SetType2() + Public Async Function TestSetType2() As Task Dim code = Class C @@ -1088,11 +1089,11 @@ Class C End Class - TestSetTypeProp(code, expected, "System.Int32") - End Sub + Await TestSetTypeProp(code, expected, "System.Int32") + End Function - Public Sub SetType3() + Public Async Function TestSetType3() As Task Dim code = Class C @@ -1111,11 +1112,11 @@ Class C End Class - TestSetTypeProp(code, expected, "String") - End Sub + Await TestSetTypeProp(code, expected, "String") + End Function - Public Sub SetType4() + Public Async Function TestSetType4() As Task Dim code = Class C @@ -1134,8 +1135,8 @@ Class C End Class - TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) - End Sub + Await TestSetTypeProp(code, expected, CType(Nothing, EnvDTE.CodeTypeRef)) + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodePropertyTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodePropertyTests.vb index 97cf228309f518003f77db8acf3580b5a450bd2a..e1ee9930ac792f3ad5624e31fe556a7fd509780d 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodePropertyTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodePropertyTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.CodeModel.Extenders Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.CodeModel.Interop @@ -12,7 +13,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "GetStartPoint() tests" - Public Sub GetStartPoint() + Public Async Function TestGetStartPoint1() As Task Dim code = Class C @@ -25,7 +26,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -46,10 +47,10 @@ End Class TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=32)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=32))) - End Sub + End Function - Public Sub GetStartPoint_Attribute() + Public Async Function TestGetStartPoint_Attribute() As Task Dim code = Class C @@ -63,7 +64,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -84,10 +85,10 @@ End Class TextPoint(line:=3, lineOffset:=5, absoluteOffset:=45, lineLength:=32)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=31))) - End Sub + End Function - Public Sub GetStartPoint_AutoProperty() + Public Async Function TestGetStartPoint_AutoProperty() As Task Dim code = Class C @@ -95,7 +96,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -116,10 +117,10 @@ End Class TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=32)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=32))) - End Sub + End Function - Public Sub GetStartPoint_AutoProperty_Attribute() + Public Async Function TestGetStartPoint_AutoProperty_Attribute() As Task Dim code = Class C @@ -128,7 +129,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -149,14 +150,14 @@ End Class TextPoint(line:=3, lineOffset:=5, absoluteOffset:=45, lineLength:=32)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=31))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint() + Public Async Function TestGetEndPoint1() As Task Dim code = Class C @@ -169,7 +170,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -190,10 +191,10 @@ End Class TextPoint(line:=7, lineOffset:=17, absoluteOffset:=132, lineLength:=16)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=7, lineOffset:=17, absoluteOffset:=132, lineLength:=16))) - End Sub + End Function - Public Sub GetEndPoint_Attribute() + Public Async Function TestGetEndPoint_Attribute() As Task Dim code = Class C @@ -207,7 +208,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=32, absoluteOffset:=40, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -228,10 +229,10 @@ End Class TextPoint(line:=8, lineOffset:=17, absoluteOffset:=164, lineLength:=16)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=8, lineOffset:=17, absoluteOffset:=164, lineLength:=16))) - End Sub + End Function - Public Sub GetEndPoint_AutoProperty() + Public Async Function TestGetEndPoint_AutoProperty() As Task Dim code = Class C @@ -239,7 +240,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -260,10 +261,10 @@ End Class TextPoint(line:=2, lineOffset:=33, absoluteOffset:=41, lineLength:=32)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=33, absoluteOffset:=41, lineLength:=32))) - End Sub + End Function - Public Sub GetEndPoint_AutoProperty_Attribute() + Public Async Function TestGetEndPoint_AutoProperty_Attribute() As Task Dim code = Class C @@ -272,7 +273,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=32, absoluteOffset:=40, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -293,14 +294,14 @@ End Class TextPoint(line:=3, lineOffset:=33, absoluteOffset:=73, lineLength:=32)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=33, absoluteOffset:=73, lineLength:=32))) - End Sub + End Function #End Region #Region "Attributes" - Public Sub Attributes_AutoProperty() + Public Async Function TestAttributes_AutoProperty() As Task Dim code = Imports System @@ -311,11 +312,11 @@ Class C1 End Class - TestAttributes(code, IsElement("CLSCompliant")) - End Sub + Await TestAttributes(code, IsElement("CLSCompliant")) + End Function - Public Sub Attributes_Property() + Public Async Function TestAttributes_Property() As Task Dim code = Imports System @@ -331,15 +332,15 @@ Class C1 End Class - TestAttributes(code, IsElement("CLSCompliant")) - End Sub + Await TestAttributes(code, IsElement("CLSCompliant")) + End Function #End Region #Region "Getter tests" - Public Sub GetterIsNothingForAutoProp() + Public Async Function TestGetterIsNothingForAutoProp() As Task Dim code = Class C @@ -347,18 +348,18 @@ Class C End Class - TestGetter(code, + Await TestGetter(code, Sub(accessor) Assert.Null(accessor) End Sub) - End Sub + End Function #End Region #Region "IsDefault tests" - Public Sub IsDefault1() + Public Async Function TestIsDefault1() As Task Dim code = Class C @@ -371,11 +372,11 @@ Class C End Class - TestIsDefault(code, True) - End Sub + Await TestIsDefault(code, True) + End Function - Public Sub IsDefault2() + Public Async Function TestIsDefault2() As Task Dim code = Class C @@ -388,11 +389,11 @@ Class C End Class - TestIsDefault(code, False) - End Sub + Await TestIsDefault(code, False) + End Function - Public Sub IsDefault3() + Public Async Function TestIsDefault3() As Task Dim code = Class C @@ -400,15 +401,15 @@ Class C End Class - TestIsDefault(code, False) - End Sub + Await TestIsDefault(code, False) + End Function #End Region #Region "Name tests" - Public Sub Name1() + Public Async Function TestName1() As Task Dim code = Class C @@ -421,11 +422,11 @@ Class C End Class - TestName(code, "P") - End Sub + Await TestName(code, "P") + End Function - Public Sub Name2() + Public Async Function TestName2() As Task Dim code = Class C @@ -433,15 +434,15 @@ Class C End Class - TestName(code, "P") - End Sub + Await TestName(code, "P") + End Function #End Region #Region "OverrideKind tests" - Public Sub OverrideKind1() + Public Async Function TestOverrideKind1() As Task Dim code = Class C @@ -454,11 +455,11 @@ Class C End Class - TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNone) - End Sub + Await TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNone) + End Function - Public Sub OverrideKind2() + Public Async Function TestOverrideKind2() As Task Dim code = Class C @@ -466,15 +467,15 @@ Class C End Class - TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) - End Sub + Await TestOverrideKind(code, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) + End Function #End Region #Region "Prototype tests" - Public Sub Prototype_UniqueSignature() + Public Async Function TestPrototype_UniqueSignature() As Task Dim code = Namespace N @@ -484,11 +485,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature, "P:N.C.P") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature, "P:N.C.P") + End Function - Public Sub Prototype_FullName() + Public Async Function TestPrototype_FullName() As Task Dim code = Namespace N @@ -498,11 +499,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "N.C.P()") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "N.C.P()") + End Function - Public Sub Prototype_ClassName1() + Public Async Function TestPrototype_ClassName1() As Task Dim code = Namespace N @@ -512,11 +513,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.P()") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.P()") + End Function - Public Sub Prototype_ClassName2() + Public Async Function TestPrototype_ClassName2() As Task Dim code = Namespace N @@ -531,11 +532,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.P()") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.P()") + End Function - Public Sub Prototype_ClassName3() + Public Async Function TestPrototype_ClassName3() As Task Dim code = Namespace N @@ -550,11 +551,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.P()") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "C.P()") + End Function - Public Sub Prototype_ClassName_ParamNames() + Public Async Function TestPrototype_ClassName_ParamNames() As Task Dim code = Namespace N @@ -569,11 +570,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName Or EnvDTE.vsCMPrototype.vsCMPrototypeParamNames, "C.P(index )") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName Or EnvDTE.vsCMPrototype.vsCMPrototypeParamNames, "C.P(index )") + End Function - Public Sub Prototype_ClassName_ParamNames_ParamTypes() + Public Async Function TestPrototype_ClassName_ParamNames_ParamTypes() As Task Dim code = Namespace N @@ -588,11 +589,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName Or EnvDTE.vsCMPrototype.vsCMPrototypeParamNames Or EnvDTE.vsCMPrototype.vsCMPrototypeParamTypes, "C.P(index As String)") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName Or EnvDTE.vsCMPrototype.vsCMPrototypeParamNames Or EnvDTE.vsCMPrototype.vsCMPrototypeParamTypes, "C.P(index As String)") + End Function - Public Sub Prototype_ClassName_ParamNames_ParamDefaultValues() + Public Async Function TestPrototype_ClassName_ParamNames_ParamDefaultValues() As Task Dim code = Namespace N @@ -607,11 +608,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName Or EnvDTE.vsCMPrototype.vsCMPrototypeParamNames Or EnvDTE.vsCMPrototype.vsCMPrototypeParamDefaultValues, "C.P(index = """")") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName Or EnvDTE.vsCMPrototype.vsCMPrototypeParamNames Or EnvDTE.vsCMPrototype.vsCMPrototypeParamDefaultValues, "C.P(index = """")") + End Function - Public Sub Prototype_ClassName_ParamTypes() + Public Async Function TestPrototype_ClassName_ParamTypes() As Task Dim code = Namespace N @@ -626,11 +627,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName Or EnvDTE.vsCMPrototype.vsCMPrototypeParamTypes, "C.P(String)") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName Or EnvDTE.vsCMPrototype.vsCMPrototypeParamTypes, "C.P(String)") + End Function - Public Sub Prototype_ClassName_ParamTypes_ParamDefaultValues() + Public Async Function TestPrototype_ClassName_ParamTypes_ParamDefaultValues() As Task Dim code = Namespace N @@ -645,11 +646,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName Or EnvDTE.vsCMPrototype.vsCMPrototypeParamTypes Or EnvDTE.vsCMPrototype.vsCMPrototypeParamDefaultValues, "C.P(String = """")") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName Or EnvDTE.vsCMPrototype.vsCMPrototypeParamTypes Or EnvDTE.vsCMPrototype.vsCMPrototypeParamDefaultValues, "C.P(String = """")") + End Function - Public Sub Prototype_ClassName_ParamNames_ParamTypes_ParamDefaultValues() + Public Async Function TestPrototype_ClassName_ParamNames_ParamTypes_ParamDefaultValues() As Task Dim code = Namespace N @@ -664,11 +665,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName Or EnvDTE.vsCMPrototype.vsCMPrototypeParamNames Or EnvDTE.vsCMPrototype.vsCMPrototypeParamTypes Or EnvDTE.vsCMPrototype.vsCMPrototypeParamDefaultValues, "C.P(index As String = """")") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName Or EnvDTE.vsCMPrototype.vsCMPrototypeParamNames Or EnvDTE.vsCMPrototype.vsCMPrototypeParamTypes Or EnvDTE.vsCMPrototype.vsCMPrototypeParamDefaultValues, "C.P(index As String = """")") + End Function - Public Sub Prototype_Type() + Public Async Function TestPrototype_Type() As Task Dim code = Namespace N @@ -683,15 +684,15 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "P()") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "P()") + End Function #End Region #Region "ReadWrite tests" - Public Sub ReadWrite1() + Public Async Function TestReadWrite1() As Task Dim code = Class C @@ -704,11 +705,11 @@ Class C End Class - TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindReadWrite) - End Sub + Await TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindReadWrite) + End Function - Public Sub ReadWrite2() + Public Async Function TestReadWrite2() As Task Dim code = Class C @@ -719,11 +720,11 @@ Class C End Class - TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindReadOnly) - End Sub + Await TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindReadOnly) + End Function - Public Sub ReadWrite3() + Public Async Function TestReadWrite3() As Task Dim code = Class C @@ -734,11 +735,11 @@ Class C End Class - TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindWriteOnly) - End Sub + Await TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindWriteOnly) + End Function - Public Sub ReadWrite4() + Public Async Function TestReadWrite4() As Task Dim code = Class C @@ -746,11 +747,11 @@ Class C End Class - TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindReadWrite) - End Sub + Await TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindReadWrite) + End Function - Public Sub ReadWrite5() + Public Async Function TestReadWrite5() As Task Dim code = Class C @@ -758,11 +759,11 @@ Class C End Class - TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindReadOnly) - End Sub + Await TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindReadOnly) + End Function - Public Sub ReadWrite6() + Public Async Function TestReadWrite6() As Task Dim code = Class C @@ -770,15 +771,15 @@ Class C End Class - TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindWriteOnly) - End Sub + Await TestReadWrite(code, EnvDTE80.vsCMPropertyKind.vsCMPropertyKindWriteOnly) + End Function #End Region #Region "Setter tests" - Public Sub SetterIsNothingForAutoProp() + Public Async Function TestSetterIsNothingForAutoProp() As Task Dim code = Class C @@ -786,18 +787,18 @@ Class C End Class - TestSetter(code, + Await TestSetter(code, Sub(accessor) Assert.Null(accessor) End Sub) - End Sub + End Function #End Region #Region "Type tests" - Public Sub Type1() + Public Async Function TestType1() As Task Dim code = Class C @@ -805,17 +806,17 @@ Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsFullName = "System.Int32", .AsString = "Integer", .CodeTypeFullName = "System.Int32", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefInt }) - End Sub + End Function - Public Sub Type2() + Public Async Function TestType2() As Task Dim code = Class C @@ -823,17 +824,17 @@ Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsFullName = "System.Text.StringBuilder", .AsString = "System.Text.StringBuilder", .CodeTypeFullName = "System.Text.StringBuilder", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType }) - End Sub + End Function - Public Sub Type3() + Public Async Function TestType3() As Task Dim code = Class C @@ -848,21 +849,21 @@ Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsFullName = "System.String", .AsString = "String", .CodeTypeFullName = "System.String", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefString }) - End Sub + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute_NormalProperty() + Public Async Function TestAddAttribute_NormalProperty() As Task Dim code = Imports System @@ -891,11 +892,11 @@ Class C End Property End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_AutoProperty() + Public Async Function TestAddAttribute_AutoProperty() As Task Dim code = Imports System @@ -914,12 +915,12 @@ Class C Property P As Integer End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_NormalProperty_BelowDocComment() + Public Async Function TestAddAttribute_NormalProperty_BelowDocComment() As Task Dim code = Imports System @@ -950,12 +951,12 @@ Class C End Property End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute_AutoProperty_BelowDocComment() + Public Async Function TestAddAttribute_AutoProperty_BelowDocComment() As Task Dim code = Imports System @@ -976,15 +977,15 @@ Class C Property P As Integer End Class - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function #End Region #Region "AddParameter tests" - Public Sub AddParameter1() + Public Async Function TestAddParameter1() As Task Dim code = Class C @@ -1009,11 +1010,11 @@ Class C End Class - TestAddParameter(code, expected, New ParameterData With {.Name = "index", .Type = "Integer"}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "index", .Type = "Integer"}) + End Function - Public Sub AddParameter2() + Public Async Function TestAddParameter2() As Task Dim code = Class C @@ -1038,15 +1039,15 @@ Class C End Class - TestAddParameter(code, expected, New ParameterData With {.Name = "index", .Type = "Integer"}) - End Sub + Await TestAddParameter(code, expected, New ParameterData With {.Name = "index", .Type = "Integer"}) + End Function #End Region #Region "RemoveParameter tests" - Public Sub RemoveParameter1() + Public Async Function TestRemoveParameter1() As Task Dim code = Class C @@ -1071,15 +1072,15 @@ Class C End Class - TestRemoveChild(code, expected, "index") - End Sub + Await TestRemoveChild(code, expected, "index") + End Function #End Region #Region "Set IsDefault tests" - Public Sub SetIsDefault1() + Public Async Function TestSetIsDefault1() As Task Dim code = Class C @@ -1104,11 +1105,11 @@ Class C End Class - TestSetIsDefault(code, expected, True) - End Sub + Await TestSetIsDefault(code, expected, True) + End Function - Public Sub SetIsDefault2() + Public Async Function TestSetIsDefault2() As Task Dim code = Class C @@ -1133,11 +1134,11 @@ Class C End Class - TestSetIsDefault(code, expected, False) - End Sub + Await TestSetIsDefault(code, expected, False) + End Function - Public Sub SetIsDefault3() + Public Async Function TestSetIsDefault3() As Task Dim code = Class C @@ -1152,11 +1153,11 @@ Class C End Class - TestSetIsDefault(code, expected, True) - End Sub + Await TestSetIsDefault(code, expected, True) + End Function - Public Sub SetIsDefault4() + Public Async Function TestSetIsDefault4() As Task Dim code = Class C @@ -1171,15 +1172,15 @@ Class C End Class - TestSetIsDefault(code, expected, False) - End Sub + Await TestSetIsDefault(code, expected, False) + End Function #End Region #Region "Set OverrideKind tests" - Public Sub SetOverrideKind1() + Public Async Function TestSetOverrideKind1() As Task Dim code = Class C @@ -1199,11 +1200,11 @@ Class C End Class - TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) - End Sub + Await TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindAbstract) + End Function - Public Sub SetOverrideKind2() + Public Async Function TestSetOverrideKind2() As Task Dim code = Class C @@ -1223,11 +1224,11 @@ Class C End Class - TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNone) - End Sub + Await TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNone) + End Function - Public Sub SetOverrideKind3() + Public Async Function TestSetOverrideKind3() As Task Dim code = Class C @@ -1247,15 +1248,15 @@ Class C End Class - TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNone) - End Sub + Await TestSetOverrideKind(code, expected, EnvDTE80.vsCMOverrideKind.vsCMOverrideKindNone) + End Function #End Region #Region "Set Type tests" - Public Sub SetType1() + Public Async Function TestSetType1() As Task Dim code = Class C @@ -1270,11 +1271,11 @@ Class C End Class - TestSetTypeProp(code, expected, "String") - End Sub + Await TestSetTypeProp(code, expected, "String") + End Function - Public Sub SetType2() + Public Async Function TestSetType2() As Task Dim code = Class C @@ -1289,11 +1290,11 @@ Class C End Class - TestSetTypeProp(code, expected, "System.Int32") - End Sub + Await TestSetTypeProp(code, expected, "System.Int32") + End Function - Public Sub SetType3() + Public Async Function TestSetType3() As Task Dim code = Class C @@ -1322,11 +1323,11 @@ Class C End Class - TestSetTypeProp(code, expected, "System.Int32") - End Sub + Await TestSetTypeProp(code, expected, "System.Int32") + End Function - Public Sub SetType4() + Public Async Function TestSetType4() As Task Dim code = Class C @@ -1355,15 +1356,15 @@ Class C End Class - TestSetTypeProp(code, expected, "System.Int32") - End Sub + Await TestSetTypeProp(code, expected, "System.Int32") + End Function #End Region #Region "AutoImplementedPropertyExtender" - Public Sub AutoImplementedPropertyExtender_IsAutoImplemented1() + Public Async Function TestAutoImplementedPropertyExtender_IsAutoImplemented1() As Task Dim code = Public Class C @@ -1371,11 +1372,11 @@ Public Class C End Class - TestAutoImplementedPropertyExtender_IsAutoImplemented(code, True) - End Sub + Await TestAutoImplementedPropertyExtender_IsAutoImplemented(code, True) + End Function - Public Sub AutoImplementedPropertyExtender_IsAutoImplemented2() + Public Async Function TestAutoImplementedPropertyExtender_IsAutoImplemented2() As Task Dim code = Public Class C @@ -1389,11 +1390,11 @@ Public Class C End Class - TestAutoImplementedPropertyExtender_IsAutoImplemented(code, False) - End Sub + Await TestAutoImplementedPropertyExtender_IsAutoImplemented(code, False) + End Function - Public Sub AutoImplementedPropertyExtender_IsAutoImplemented3() + Public Async Function TestAutoImplementedPropertyExtender_IsAutoImplemented3() As Task Dim code = Public Interface I @@ -1401,8 +1402,8 @@ Public Interface I End Interface - TestAutoImplementedPropertyExtender_IsAutoImplemented(code, False) - End Sub + Await TestAutoImplementedPropertyExtender_IsAutoImplemented(code, False) + End Function #End Region @@ -1410,7 +1411,7 @@ End Interface - Public Sub TestParameterNameWithEscapeCharacters() + Public Async Function TestParameterNameWithEscapeCharacters() As Task Dim code = Class Program @@ -1428,12 +1429,12 @@ Class Program End Class - TestAllParameterNames(code, "[integer]") - End Sub + Await TestAllParameterNames(code, "[integer]") + End Function - Public Sub TestParameterNameWithEscapeCharacters_2() + Public Async Function TestParameterNameWithEscapeCharacters_2() As Task Dim code = Class Program @@ -1451,8 +1452,8 @@ Class Program End Class - TestAllParameterNames(code, "[integer]", "[string]") - End Sub + Await TestAllParameterNames(code, "[integer]", "[string]") + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeStructTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeStructTests.vb index 70cd2c23c75a8243fc1cc2cdf06f12a012ca97d4..5b328ea7d4de08e5336af2712f6e02e83cf17ba5 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeStructTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeStructTests.vb @@ -1,6 +1,7 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. Imports System.Runtime.InteropServices +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.CodeModel.Extenders Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.CodeModel.Interop @@ -12,29 +13,29 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "Parts tests" - Public Sub Parts1() + Public Async Function TestParts1() As Task Dim code = Structure $$S End Structure - TestParts(code, 1) - End Sub + Await TestParts(code, 1) + End Function - Public Sub Parts2() + Public Async Function TestParts2() As Task Dim code = Partial Structure $$S End Structure - TestParts(code, 1) - End Sub + Await TestParts(code, 1) + End Function - Public Sub Parts3() + Public Async Function TestParts3() As Task Dim code = Partial Structure $$S @@ -44,14 +45,14 @@ Partial Structure S End Structure - TestParts(code, 2) - End Sub + Await TestParts(code, 2) + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = Imports System @@ -68,11 +69,11 @@ Imports System Structure S End Structure - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = Imports System @@ -91,12 +92,12 @@ Imports System Structure S End Structure - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment() + Public Async Function TestAddAttribute_BelowDocComment() As Task Dim code = Imports System @@ -115,15 +116,15 @@ Imports System Structure S End Structure - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True"}) + End Function #End Region #Region "AddImplementedInterface tests" - Public Sub AddImplementedInterface1() + Public Async Function TestAddImplementedInterface1() As Task Dim code = Structure $$S @@ -137,11 +138,11 @@ Structure S End Structure - TestAddImplementedInterface(code, "I", Nothing, expected) - End Sub + Await TestAddImplementedInterface(code, "I", Nothing, expected) + End Function - Public Sub AddImplementedInterface2() + Public Async Function TestAddImplementedInterface2() As Task Dim code = Structure $$S @@ -157,11 +158,11 @@ Structure S End Structure - TestAddImplementedInterface(code, "J", Nothing, expected) - End Sub + Await TestAddImplementedInterface(code, "J", Nothing, expected) + End Function - Public Sub AddImplementedInterface3() + Public Async Function TestAddImplementedInterface3() As Task Dim code = Structure $$S @@ -177,26 +178,26 @@ Structure S End Structure - TestAddImplementedInterface(code, "J", -1, expected) - End Sub + Await TestAddImplementedInterface(code, "J", -1, expected) + End Function - Public Sub AddImplementedInterface4() + Public Async Function TestAddImplementedInterface4() As Task Dim code = Structure $$S End Structure - TestAddImplementedInterfaceThrows(Of ArgumentException)(code, "I", 1) - End Sub + Await TestAddImplementedInterfaceThrows(Of ArgumentException)(code, "I", 1) + End Function #End Region #Region "RemoveImplementedInterface tests" - Public Sub RemoveImplementedInterface1() + Public Async Function TestRemoveImplementedInterface1() As Task Dim code = Structure $$S @@ -209,22 +210,22 @@ End Structure Structure S End Structure - TestRemoveImplementedInterface(code, "I", expected) - End Sub + Await TestRemoveImplementedInterface(code, "I", expected) + End Function - Public Sub RemoveImplementedInterface2() + Public Async Function TestRemoveImplementedInterface2() As Task Dim code = Structure $$S End Structure - TestRemoveImplementedInterfaceThrows(Of COMException)(code, "I") - End Sub + Await TestRemoveImplementedInterfaceThrows(Of COMException)(code, "I") + End Function - Public Sub RemoveImplementedInterface3() + Public Async Function TestRemoveImplementedInterface3() As Task Dim code = Structure $$S @@ -238,11 +239,11 @@ Structure S Implements I End Structure - TestRemoveImplementedInterface(code, "J", expected) - End Sub + Await TestRemoveImplementedInterface(code, "J", expected) + End Function - Public Sub RemoveImplementedInterface4() + Public Async Function TestRemoveImplementedInterface4() As Task Dim code = Structure $$S @@ -256,11 +257,11 @@ Structure S Implements J End Structure - TestRemoveImplementedInterface(code, "I", expected) - End Sub + Await TestRemoveImplementedInterface(code, "I", expected) + End Function - Public Sub RemoveImplementedInterface5() + Public Async Function TestRemoveImplementedInterface5() As Task Dim code = Structure $$S @@ -274,14 +275,14 @@ Structure S Implements I, K End Structure - TestRemoveImplementedInterface(code, "J", expected) - End Sub + Await TestRemoveImplementedInterface(code, "J", expected) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = Structure $$Foo @@ -294,47 +295,47 @@ Structure Bar End Structure - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region #Region "GenericExtender" - Public Sub GenericExtender_GetBaseTypesCount() + Public Async Function TestGenericExtender_GetBaseTypesCount() As Task Dim code = Structure S$$ End Structure - TestGenericNameExtender_GetBaseTypesCount(code, 1) - End Sub + Await TestGenericNameExtender_GetBaseTypesCount(code, 1) + End Function - Public Sub GenericExtender_GetBaseGenericName() + Public Async Function TestGenericExtender_GetBaseGenericName() As Task Dim code = Structure S$$ End Structure - TestGenericNameExtender_GetBaseGenericName(code, 1, "System.ValueType") - End Sub + Await TestGenericNameExtender_GetBaseGenericName(code, 1, "System.ValueType") + End Function - Public Sub GenericExtender_GetImplementedTypesCount1() + Public Async Function TestGenericExtender_GetImplementedTypesCount1() As Task Dim code = Structure S$$ End Structure - TestGenericNameExtender_GetImplementedTypesCount(code, 0) - End Sub + Await TestGenericNameExtender_GetImplementedTypesCount(code, 0) + End Function - Public Sub GenericExtender_GetImplementedTypesCount2() + Public Async Function TestGenericExtender_GetImplementedTypesCount2() As Task Dim code = Namespace N @@ -348,22 +349,22 @@ Namespace N End Namespace - TestGenericNameExtender_GetImplementedTypesCount(code, 1) - End Sub + Await TestGenericNameExtender_GetImplementedTypesCount(code, 1) + End Function - Public Sub GenericExtender_GetImplTypeGenericName1() + Public Async Function TestGenericExtender_GetImplTypeGenericName1() As Task Dim code = Structure S$$ End Structure - TestGenericNameExtender_GetImplTypeGenericName(code, 1, Nothing) - End Sub + Await TestGenericNameExtender_GetImplTypeGenericName(code, 1, Nothing) + End Function - Public Sub GenericExtender_GetImplTypeGenericName2() + Public Async Function TestGenericExtender_GetImplTypeGenericName2() As Task Dim code = Namespace N @@ -377,8 +378,8 @@ Namespace N End Namespace - TestGenericNameExtender_GetImplTypeGenericName(code, 1, "N.IFoo(Of Integer)") - End Sub + Await TestGenericNameExtender_GetImplTypeGenericName(code, 1, "N.IFoo(Of Integer)") + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeVariableTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeVariableTests.vb index 7ca4a8542140ac5b7977ddf3c47f97d9760af680..22458e876478a241f66bff494e6c1ae9f3a8512d 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeVariableTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeVariableTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,7 +11,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "GetStartPoint() tests" - Public Sub GetStartPoint() + Public Async Function TestGetStartPoint1() As Task Dim code = Class C @@ -18,7 +19,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -39,10 +40,10 @@ End Class TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=20)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=20))) - End Sub + End Function - Public Sub GetStartPoint_Attribute() + Public Async Function TestGetStartPoint_Attribute() As Task Dim code = Class C @@ -51,7 +52,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -72,10 +73,10 @@ End Class TextPoint(line:=3, lineOffset:=5, absoluteOffset:=45, lineLength:=20)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=13, lineLength:=31))) - End Sub + End Function - Public Sub GetStartPoint_EnumMember() + Public Async Function TestGetStartPoint_EnumMember() As Task Dim code = Enum E @@ -83,7 +84,7 @@ Enum E End Enum - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -104,10 +105,10 @@ End Enum TextPoint(line:=2, lineOffset:=5, absoluteOffset:=12, lineLength:=5)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=12, lineLength:=5))) - End Sub + End Function - Public Sub GetStartPoint_EnumMember_Attribute() + Public Async Function TestGetStartPoint_EnumMember_Attribute() As Task Dim code = Enum E @@ -116,7 +117,7 @@ Enum E End Enum - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=12, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -137,14 +138,14 @@ End Enum TextPoint(line:=3, lineOffset:=5, absoluteOffset:=44, lineLength:=5)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=5, absoluteOffset:=12, lineLength:=31))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint() + Public Async Function TestGetEndPoint1() As Task Dim code = Class C @@ -152,7 +153,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -173,10 +174,10 @@ End Class TextPoint(line:=2, lineOffset:=21, absoluteOffset:=29, lineLength:=20)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=21, absoluteOffset:=29, lineLength:=20))) - End Sub + End Function - Public Sub GetEndPoint_Attribute() + Public Async Function TestGetEndPoint_Attribute() As Task Dim code = Class C @@ -185,7 +186,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=32, absoluteOffset:=40, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -206,10 +207,10 @@ End Class TextPoint(line:=3, lineOffset:=21, absoluteOffset:=61, lineLength:=20)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=21, absoluteOffset:=61, lineLength:=20))) - End Sub + End Function - Public Sub GetEndPoint_EnumMember() + Public Async Function TestGetEndPoint_EnumMember() As Task Dim code = Enum E @@ -217,7 +218,7 @@ Enum E End Enum - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -238,10 +239,10 @@ End Enum TextPoint(line:=2, lineOffset:=6, absoluteOffset:=13, lineLength:=5)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=2, lineOffset:=6, absoluteOffset:=13, lineLength:=5))) - End Sub + End Function - Public Sub GetEndPoint_EnumMember_Attribute() + Public Async Function TestGetEndPoint_EnumMember_Attribute() As Task Dim code = Enum E @@ -250,7 +251,7 @@ Enum E End Enum - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, TextPoint(line:=2, lineOffset:=32, absoluteOffset:=39, lineLength:=31)), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -271,14 +272,14 @@ End Enum TextPoint(line:=3, lineOffset:=6, absoluteOffset:=45, lineLength:=5)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=3, lineOffset:=6, absoluteOffset:=45, lineLength:=5))) - End Sub + End Function #End Region #Region "Access tests" - Public Sub Access1() + Public Async Function TestAccess1() As Task Dim code = Class C @@ -286,11 +287,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access2() + Public Async Function TestAccess2() As Task Dim code = Class C @@ -298,11 +299,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPrivate) + End Function - Public Sub Access3() + Public Async Function TestAccess3() As Task Dim code = Class C @@ -310,11 +311,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProtected) + End Function - Public Sub Access4() + Public Async Function TestAccess4() As Task Dim code = Class C @@ -322,11 +323,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub Access5() + Public Async Function TestAccess5() As Task Dim code = Class C @@ -334,11 +335,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessProject) + End Function - Public Sub Access6() + Public Async Function TestAccess6() As Task Dim code = Class C @@ -346,11 +347,11 @@ Class C End Class - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub Access7() + Public Async Function TestAccess7() As Task Dim code = Enum E @@ -358,8 +359,8 @@ Enum E End Enum - TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestAccess(code, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function #End Region @@ -367,7 +368,7 @@ End Enum - Public Sub Comment1() + Public Async Function TestComment1() As Task Dim code = Class C @@ -378,15 +379,15 @@ End Class Dim result = " Foo" - TestComment(code, result) - End Sub + Await TestComment(code, result) + End Function #End Region #Region "ConstKind tests" - Public Sub ConstKind1() + Public Async Function TestConstKind1() As Task Dim code = Enum E @@ -394,11 +395,11 @@ Enum E End Enum - TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindConst) - End Sub + Await TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindConst) + End Function - Public Sub ConstKind2() + Public Async Function TestConstKind2() As Task Dim code = Class C @@ -406,11 +407,11 @@ Class C End Class - TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindNone) - End Sub + Await TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindNone) + End Function - Public Sub ConstKind3() + Public Async Function TestConstKind3() As Task Dim code = Class C @@ -418,11 +419,11 @@ Class C End Class - TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindConst) - End Sub + Await TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindConst) + End Function - Public Sub ConstKind4() + Public Async Function TestConstKind4() As Task Dim code = Class C @@ -430,11 +431,11 @@ Class C End Class - TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly) - End Sub + Await TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly) + End Function - Public Sub ConstKind5() + Public Async Function TestConstKind5() As Task Dim code = Class C @@ -442,15 +443,15 @@ Class C End Class - TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindConst) - End Sub + Await TestConstKind(code, EnvDTE80.vsCMConstKind.vsCMConstKindConst) + End Function #End Region #Region "InitExpression tests" - Public Sub InitExpression1() + Public Async Function TestInitExpression1() As Task Dim code = Class C @@ -458,11 +459,11 @@ Class C End Class - TestInitExpression(code, "42") - End Sub + Await TestInitExpression(code, "42") + End Function - Public Sub InitExpression2() + Public Async Function TestInitExpression2() As Task Dim code = Class C @@ -470,11 +471,11 @@ Class C End Class - TestInitExpression(code, "19 + 23") - End Sub + Await TestInitExpression(code, "19 + 23") + End Function - Public Sub InitExpression3() + Public Async Function TestInitExpression3() As Task Dim code = Enum E @@ -482,74 +483,74 @@ Enum E End Enum - TestInitExpression(code, "19 + 23") - End Sub + Await TestInitExpression(code, "19 + 23") + End Function #End Region #Region "IsConstant tests" - Public Sub IsConstant1() + Public Async Function TestIsConstant1() As Task Dim code = Enum E $$Foo End Enum - TestIsConstant(code, True) - End Sub + Await TestIsConstant(code, True) + End Function - Public Sub IsConstant2() + Public Async Function TestIsConstant2() As Task Dim code = Class C Dim $$x As Integer End Class - TestIsConstant(code, False) - End Sub + Await TestIsConstant(code, False) + End Function - Public Sub IsConstant3() + Public Async Function TestIsConstant3() As Task Dim code = Class C Const $$x As Integer = 0 End Class - TestIsConstant(code, True) - End Sub + Await TestIsConstant(code, True) + End Function - Public Sub IsConstant4() + Public Async Function TestIsConstant4() As Task Dim code = Class C ReadOnly $$x As Integer = 0 End Class - TestIsConstant(code, True) - End Sub + Await TestIsConstant(code, True) + End Function - Public Sub IsConstant5() + Public Async Function TestIsConstant5() As Task Dim code = Class C WithEvents $$x As Integer End Class - TestIsConstant(code, False) - End Sub + Await TestIsConstant(code, False) + End Function #End Region #Region "IsShared tests" - Public Sub IsShared1() + Public Async Function TestIsShared1() As Task Dim code = Class C @@ -557,11 +558,11 @@ Class C End Class - TestIsShared(code, False) - End Sub + Await TestIsShared(code, False) + End Function - Public Sub IsShared2() + Public Async Function TestIsShared2() As Task Dim code = Class C @@ -569,8 +570,8 @@ Class C End Class - TestIsShared(code, True) - End Sub + Await TestIsShared(code, True) + End Function #End Region @@ -578,7 +579,7 @@ End Class - Public Sub TestName_EnumMember() + Public Async Function TestName_EnumMember() As Task Dim code = Enum SomeEnum @@ -586,15 +587,15 @@ Enum SomeEnum End Enum - TestName(code, "A") - End Sub + Await TestName(code, "A") + End Function #End Region #Region "Prototype tests" - Public Sub Prototype_UniqueSignature() + Public Async Function TestPrototype_UniqueSignature() As Task Dim code = Namespace N @@ -604,11 +605,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature, "F:N.C.x") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeUniqueSignature, "F:N.C.x") + End Function - Public Sub Prototype_ClassName1() + Public Async Function TestPrototype_ClassName1() As Task Dim code = Namespace N @@ -618,11 +619,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "Private C.x") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "Private C.x") + End Function - Public Sub Prototype_ClassName2() + Public Async Function TestPrototype_ClassName2() As Task Dim code = Namespace N @@ -632,11 +633,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "Private C(Of T).x") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "Private C(Of T).x") + End Function - Public Sub Prototype_ClassName3() + Public Async Function TestPrototype_ClassName3() As Task Dim code = Namespace N @@ -646,11 +647,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "Public C.x") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName, "Public C.x") + End Function - Public Sub Prototype_ClassName_InitExpression() + Public Async Function TestPrototype_ClassName_InitExpression() As Task Dim code = Namespace N @@ -660,11 +661,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName Or EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression, "Private C.x = 42") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeClassName Or EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression, "Private C.x = 42") + End Function - Public Sub Prototype_FullName1() + Public Async Function TestPrototype_FullName1() As Task Dim code = Namespace N @@ -674,11 +675,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "Private N.C.x") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "Private N.C.x") + End Function - Public Sub Prototype_FullName2() + Public Async Function TestPrototype_FullName2() As Task Dim code = Namespace N @@ -688,11 +689,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "Private N.C(Of T).x") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname, "Private N.C(Of T).x") + End Function - Public Sub Prototype_FullName_InitExpression() + Public Async Function TestPrototype_FullName_InitExpression() As Task Dim code = Namespace N @@ -702,11 +703,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname Or EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression, "Private N.C.x = 42") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeFullname Or EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression, "Private N.C.x = 42") + End Function - Public Sub Prototype_NoName() + Public Async Function TestPrototype_NoName() As Task Dim code = Namespace N @@ -716,11 +717,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeNoName, "Private ") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeNoName, "Private ") + End Function - Public Sub Prototype_NoName_InitExpression() + Public Async Function TestPrototype_NoName_InitExpression() As Task Dim code = Namespace N @@ -730,11 +731,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeNoName Or EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression, "Private = 42") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeNoName Or EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression, "Private = 42") + End Function - Public Sub Prototype_NoName_InitExpression_Type() + Public Async Function TestPrototype_NoName_InitExpression_Type() As Task Dim code = Namespace N @@ -744,11 +745,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeNoName Or EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression Or EnvDTE.vsCMPrototype.vsCMPrototypeType, "Private As Integer = 42") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeNoName Or EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression Or EnvDTE.vsCMPrototype.vsCMPrototypeType, "Private As Integer = 42") + End Function - Public Sub Prototype_InitExpression_Type_ForAsNew() + Public Async Function TestPrototype_InitExpression_Type_ForAsNew() As Task ' Amusingly, this will *crash* Dev10. Dim code = @@ -760,11 +761,11 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression Or EnvDTE.vsCMPrototype.vsCMPrototypeType, "Private x As System.Text.StringBuilder") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeInitExpression Or EnvDTE.vsCMPrototype.vsCMPrototypeType, "Private x As System.Text.StringBuilder") + End Function - Public Sub Prototype_Type() + Public Async Function TestPrototype_Type() As Task Dim code = Namespace N @@ -774,15 +775,15 @@ Namespace N End Namespace - TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "Private x As Integer") - End Sub + Await TestPrototype(code, EnvDTE.vsCMPrototype.vsCMPrototypeType, "Private x As Integer") + End Function #End Region #Region "Type tests" - Public Sub Type1() + Public Async Function TestType1() As Task Dim code = Class C @@ -790,17 +791,17 @@ Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "Integer", .AsFullName = "System.Int32", .CodeTypeFullName = "System.Int32", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefInt }) - End Sub + End Function - Public Sub Type2() + Public Async Function TestType2() As Task Dim code = Class C @@ -808,17 +809,17 @@ Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "Object", .AsFullName = "System.Object", .CodeTypeFullName = "System.Object", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefObject }) - End Sub + End Function - Public Sub Type3() + Public Async Function TestType3() As Task Dim code = Class C @@ -826,21 +827,21 @@ Class C End Class - TestTypeProp(code, + Await TestTypeProp(code, New CodeTypeRefData With { .AsString = "Object", .AsFullName = "System.Object", .CodeTypeFullName = "System.Object", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefObject }) - End Sub + End Function #End Region #Region "AddAttribute tests" - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = Imports System @@ -859,12 +860,12 @@ Class C Dim foo As Integer End Class ]]> - TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "Serializable"}) + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True", .Position = 1}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True", .Position = 1}) + End Function - Public Sub AddAttribute_BelowDocComment() + Public Async Function TestAddAttribute_BelowDocComment() As Task Dim code = - TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True"}) - End Sub + Await TestAddAttribute(code, expected, New AttributeData With {.Name = "CLSCompliant", .Value = "True"}) + End Function #End Region #Region "Set Access tests" - Public Sub SetEnumAccess1() + Public Async Function TestSetEnumAccess1() As Task Dim code = Enum E @@ -934,11 +935,11 @@ Enum E End Enum - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetEnumAccess2() + Public Async Function TestSetEnumAccess2() As Task Dim code = Enum E @@ -953,11 +954,11 @@ Enum E End Enum - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetEnumAccess3() + Public Async Function TestSetEnumAccess3() As Task Dim code = Enum E @@ -972,11 +973,11 @@ Enum E End Enum - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPrivate, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPrivate, ThrowsArgumentException(Of EnvDTE.vsCMAccess)()) + End Function - Public Sub SetAccess1() + Public Async Function TestSetAccess1() As Task Dim code = Class C @@ -991,11 +992,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetAccess2() + Public Async Function TestSetAccess2() As Task Dim code = Class C @@ -1010,11 +1011,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetAccess3() + Public Async Function TestSetAccess3() As Task Dim code = Class C @@ -1029,11 +1030,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetAccess4() + Public Async Function TestSetAccess4() As Task Dim code = Class C @@ -1048,11 +1049,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetAccess5() + Public Async Function TestSetAccess5() As Task Dim code = Class C @@ -1067,11 +1068,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub SetAccess6() + Public Async Function TestSetAccess6() As Task Dim code = Class C @@ -1102,11 +1103,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetAccess7() + Public Async Function TestSetAccess7() As Task Dim code = Class C @@ -1137,11 +1138,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub SetAccess8() + Public Async Function TestSetAccess8() As Task Dim code = Class C @@ -1172,11 +1173,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetAccess9() + Public Async Function TestSetAccess9() As Task Dim code = Class C @@ -1203,11 +1204,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPublic) + End Function - Public Sub SetAccess10() + Public Async Function TestSetAccess10() As Task Dim code = Class C @@ -1234,11 +1235,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function - Public Sub SetAccess11() + Public Async Function TestSetAccess11() As Task Dim code = Class C @@ -1265,11 +1266,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub SetAccess12() + Public Async Function TestSetAccess12() As Task Dim code = - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub SetAccess13() + Public Async Function TestSetAccess13() As Task Dim code = Class C @@ -1331,11 +1332,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub SetAccess14() + Public Async Function TestSetAccess14() As Task Dim code = - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessProjectOrProtected) + End Function - Public Sub SetAccess15() + Public Async Function TestSetAccess15() As Task Dim code = Class C @@ -1391,11 +1392,11 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPrivate Or EnvDTE.vsCMAccess.vsCMAccessWithEvents) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessPrivate Or EnvDTE.vsCMAccess.vsCMAccessWithEvents) + End Function - Public Sub SetAccess16() + Public Async Function TestSetAccess16() As Task Dim code = Class C @@ -1414,15 +1415,15 @@ Class C End Class - TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) - End Sub + Await TestSetAccess(code, expected, EnvDTE.vsCMAccess.vsCMAccessDefault) + End Function #End Region #Region "Set ConstKind tests" - Public Sub SetConstKind1() + Public Async Function TestSetConstKind1() As Task Dim code = Enum @@ -1437,11 +1438,11 @@ Enum End Enum - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone, ThrowsNotImplementedException(Of EnvDTE80.vsCMConstKind)) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone, ThrowsNotImplementedException(Of EnvDTE80.vsCMConstKind)) + End Function - Public Sub SetConstKind2() + Public Async Function TestSetConstKind2() As Task Dim code = Enum @@ -1456,11 +1457,11 @@ Enum End Enum - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly, ThrowsNotImplementedException(Of EnvDTE80.vsCMConstKind)) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly, ThrowsNotImplementedException(Of EnvDTE80.vsCMConstKind)) + End Function - Public Sub SetConstKind3() + Public Async Function TestSetConstKind3() As Task Dim code = Enum @@ -1475,11 +1476,11 @@ Enum End Enum - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindConst, ThrowsNotImplementedException(Of EnvDTE80.vsCMConstKind)) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindConst, ThrowsNotImplementedException(Of EnvDTE80.vsCMConstKind)) + End Function - Public Sub SetConstKind4() + Public Async Function TestSetConstKind4() As Task Dim code = Class C @@ -1494,11 +1495,11 @@ Class C End Class - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) + End Function - Public Sub SetConstKind5() + Public Async Function TestSetConstKind5() As Task Dim code = Class C @@ -1513,11 +1514,11 @@ Class C End Class - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) + End Function - Public Sub SetConstKind6() + Public Async Function TestSetConstKind6() As Task Dim code = Class C @@ -1532,11 +1533,11 @@ Class C End Class - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindConst) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindConst) + End Function - Public Sub SetConstKind7() + Public Async Function TestSetConstKind7() As Task Dim code = Class C @@ -1551,11 +1552,11 @@ Class C End Class - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) + End Function - Public Sub SetConstKind8() + Public Async Function TestSetConstKind8() As Task Dim code = Class C @@ -1570,11 +1571,11 @@ Class C End Class - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindReadOnly) + End Function - Public Sub SetConstKind9() + Public Async Function TestSetConstKind9() As Task Dim code = Class C @@ -1589,15 +1590,15 @@ Class C End Class - TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) - End Sub + Await TestSetConstKind(code, expected, EnvDTE80.vsCMConstKind.vsCMConstKindNone) + End Function #End Region #Region "Set InitExpression tests" - Public Sub SetInitExpression1() + Public Async Function TestSetInitExpression1() As Task Dim code = Class C @@ -1612,11 +1613,11 @@ Class C End Class - TestSetInitExpression(code, expected, "42") - End Sub + Await TestSetInitExpression(code, expected, "42") + End Function - Public Sub SetInitExpression2() + Public Async Function TestSetInitExpression2() As Task Dim code = Class C @@ -1631,11 +1632,11 @@ Class C End Class - TestSetInitExpression(code, expected, "42") - End Sub + Await TestSetInitExpression(code, expected, "42") + End Function - Public Sub SetInitExpression3() + Public Async Function TestSetInitExpression3() As Task Dim code = Class C @@ -1650,11 +1651,11 @@ Class C End Class - TestSetInitExpression(code, expected, "42") - End Sub + Await TestSetInitExpression(code, expected, "42") + End Function - Public Sub SetInitExpression4() + Public Async Function TestSetInitExpression4() As Task ' The result below is a bit silly, but that's what the legacy Code Model does. Dim code = @@ -1671,11 +1672,11 @@ Class C End Class - TestSetInitExpression(code, expected, "42") - End Sub + Await TestSetInitExpression(code, expected, "42") + End Function - Public Sub SetInitExpression5() + Public Async Function TestSetInitExpression5() As Task Dim code = Class C @@ -1690,11 +1691,11 @@ Class C End Class - TestSetInitExpression(code, expected, "19 + 23") - End Sub + Await TestSetInitExpression(code, expected, "19 + 23") + End Function - Public Sub SetInitExpression6() + Public Async Function TestSetInitExpression6() As Task Dim code = Class C @@ -1709,11 +1710,11 @@ Class C End Class - TestSetInitExpression(code, expected, "") - End Sub + Await TestSetInitExpression(code, expected, "") + End Function - Public Sub SetInitExpression7() + Public Async Function TestSetInitExpression7() As Task Dim code = Enum E @@ -1728,11 +1729,11 @@ Enum E End Enum - TestSetInitExpression(code, expected, "42") - End Sub + Await TestSetInitExpression(code, expected, "42") + End Function - Public Sub SetInitExpression8() + Public Async Function TestSetInitExpression8() As Task Dim code = Enum E @@ -1747,11 +1748,11 @@ Enum E End Enum - TestSetInitExpression(code, expected, "42") - End Sub + Await TestSetInitExpression(code, expected, "42") + End Function - Public Sub SetInitExpression9() + Public Async Function TestSetInitExpression9() As Task Dim code = Enum E @@ -1766,15 +1767,15 @@ Enum E End Enum - TestSetInitExpression(code, expected, Nothing) - End Sub + Await TestSetInitExpression(code, expected, Nothing) + End Function #End Region #Region "Set IsConstant tests" - Public Sub SetIsConstant1() + Public Async Function TestSetIsConstant1() As Task Dim code = Class C @@ -1789,11 +1790,11 @@ Class C End Class - TestSetIsConstant(code, expected, True) - End Sub + Await TestSetIsConstant(code, expected, True) + End Function - Public Sub SetIsConstant2() + Public Async Function TestSetIsConstant2() As Task Dim code = Class C @@ -1808,11 +1809,11 @@ Class C End Class - TestSetIsConstant(code, expected, False) - End Sub + Await TestSetIsConstant(code, expected, False) + End Function - Public Sub SetIsConstant3() + Public Async Function TestSetIsConstant3() As Task Dim code = Class C @@ -1827,11 +1828,11 @@ Class C End Class - TestSetIsConstant(code, expected, True) - End Sub + Await TestSetIsConstant(code, expected, True) + End Function - Public Sub SetIsConstant4() + Public Async Function TestSetIsConstant4() As Task Dim code = Class C @@ -1846,11 +1847,11 @@ Class C End Class - TestSetIsConstant(code, expected, False) - End Sub + Await TestSetIsConstant(code, expected, False) + End Function - Public Sub SetIsConstant5() + Public Async Function TestSetIsConstant5() As Task Dim code = Module C @@ -1865,11 +1866,11 @@ Module C End Module - TestSetIsConstant(code, expected, True) - End Sub + Await TestSetIsConstant(code, expected, True) + End Function - Public Sub SetIsConstant6() + Public Async Function TestSetIsConstant6() As Task Dim code = Enum E @@ -1884,11 +1885,11 @@ Enum E End Enum - TestSetIsConstant(code, expected, True, ThrowsNotImplementedException(Of Boolean)) - End Sub + Await TestSetIsConstant(code, expected, True, ThrowsNotImplementedException(Of Boolean)) + End Function - Public Sub SetIsConstant7() + Public Async Function TestSetIsConstant7() As Task Dim code = Enum E @@ -1903,15 +1904,15 @@ Enum E End Enum - TestSetIsConstant(code, expected, False, ThrowsNotImplementedException(Of Boolean)) - End Sub + Await TestSetIsConstant(code, expected, False, ThrowsNotImplementedException(Of Boolean)) + End Function #End Region #Region "Set IsShared tests" - Public Sub SetIsShared1() + Public Async Function TestSetIsShared1() As Task Dim code = Class C @@ -1926,11 +1927,11 @@ Class C End Class - TestSetIsShared(code, expected, True) - End Sub + Await TestSetIsShared(code, expected, True) + End Function - Public Sub SetIsShared2() + Public Async Function TestSetIsShared2() As Task Dim code = Class C @@ -1945,11 +1946,11 @@ Class C End Class - TestSetIsShared(code, expected, False) - End Sub + Await TestSetIsShared(code, expected, False) + End Function - Public Sub SetIsShared3() + Public Async Function TestSetIsShared3() As Task Dim code = Class C @@ -1964,11 +1965,11 @@ Class C End Class - TestSetIsShared(code, expected, True) - End Sub + Await TestSetIsShared(code, expected, True) + End Function - Public Sub SetIsShared4() + Public Async Function TestSetIsShared4() As Task Dim code = Class C @@ -1983,11 +1984,11 @@ Class C End Class - TestSetIsShared(code, expected, False) - End Sub + Await TestSetIsShared(code, expected, False) + End Function - Public Sub SetIsShared5() + Public Async Function TestSetIsShared5() As Task Dim code = Module C @@ -2002,11 +2003,11 @@ Module C End Module - TestSetIsShared(code, expected, True, ThrowsNotImplementedException(Of Boolean)) - End Sub + Await TestSetIsShared(code, expected, True, ThrowsNotImplementedException(Of Boolean)) + End Function - Public Sub SetIsShared6() + Public Async Function TestSetIsShared6() As Task Dim code = Enum E @@ -2021,15 +2022,15 @@ Enum E End Enum - TestSetIsShared(code, expected, True, ThrowsNotImplementedException(Of Boolean)) - End Sub + Await TestSetIsShared(code, expected, True, ThrowsNotImplementedException(Of Boolean)) + End Function #End Region #Region "Set Name tests" - Public Sub SetName1() + Public Async Function TestSetName1() As Task Dim code = Class C @@ -2044,11 +2045,11 @@ Class C End Class - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function - Public Sub SetName2() + Public Async Function TestSetName2() As Task Dim code = Class C @@ -2075,15 +2076,15 @@ Class C End Class - TestSetName(code, expected, "Bar", NoThrow(Of String)()) - End Sub + Await TestSetName(code, expected, "Bar", NoThrow(Of String)()) + End Function #End Region #Region "Set Type tests" - Public Sub SetType1() + Public Async Function TestSetType1() As Task Dim code = Class C @@ -2098,11 +2099,11 @@ Class C End Class - TestSetTypeProp(code, expected, "double") - End Sub + Await TestSetTypeProp(code, expected, "double") + End Function - Public Sub SetType2() + Public Async Function TestSetType2() As Task Dim code = Class C @@ -2117,11 +2118,11 @@ Class C End Class - TestSetTypeProp(code, expected, "double") - End Sub + Await TestSetTypeProp(code, expected, "double") + End Function - Public Sub SetType3() + Public Async Function TestSetType3() As Task Dim code = Class C @@ -2136,11 +2137,11 @@ Class C End Class - TestSetTypeProp(code, expected, "String") - End Sub + Await TestSetTypeProp(code, expected, "String") + End Function - Public Sub SetType4() + Public Async Function TestSetType4() As Task Dim code = Class C @@ -2155,11 +2156,11 @@ Class C End Class - TestSetTypeProp(code, expected, "String") - End Sub + Await TestSetTypeProp(code, expected, "String") + End Function - Public Sub SetType5() + Public Async Function TestSetType5() As Task Dim code = Class C @@ -2174,8 +2175,8 @@ Class C End Class - TestSetTypeProp(code, expected, "String") - End Sub + Await TestSetTypeProp(code, expected, "String") + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/EventCollectorTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/EventCollectorTests.vb index 7e89c7f40f6a9ba92e5e0795386681c7ba4e4d64..f1d7ec3ae326e57d3939594dbd41b3d6c817123d 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/EventCollectorTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/EventCollectorTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel Imports Roslyn.Test.Utilities @@ -11,7 +12,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "Imports statements" - Public Sub TestImportsStatement_Add1() + Public Async Function TestImportsStatement_Add1() As Task Dim code = @@ -21,12 +22,12 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi Imports System - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System")) - End Sub + End Function - Public Sub TestImportsStatement_Add2() + Public Async Function TestImportsStatement_Add2() As Task Dim code = Imports System @@ -40,12 +41,12 @@ Imports System Imports System.Collections.Generic - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System.Linq")) - End Sub + End Function - Public Sub TestImportsStatement_Add3() + Public Async Function TestImportsStatement_Add3() As Task Dim code = Imports System @@ -59,12 +60,12 @@ Imports System Imports System.Collections.Generic - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System.Linq")) - End Sub + End Function - Public Sub TestImportsStatement_Add4() + Public Async Function TestImportsStatement_Add4() As Task Dim code = Imports System @@ -78,12 +79,12 @@ Imports System Imports System.Collections.Generic - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System.Linq")) - End Sub + End Function - Public Sub TestImportsStatement_Add5() + Public Async Function TestImportsStatement_Add5() As Task Dim code = Imports System @@ -96,12 +97,12 @@ Imports System.Linq, System Imports System.Collections.Generic - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System.Linq")) - End Sub + End Function - Public Sub TestImportsStatement_Add6() + Public Async Function TestImportsStatement_Add6() As Task Dim code = Imports System @@ -114,12 +115,12 @@ Imports System, System.Linq Imports System.Collections.Generic - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System.Linq")) - End Sub + End Function - Public Sub TestImportsStatement_Add7() + Public Async Function TestImportsStatement_Add7() As Task Dim code = Imports System @@ -132,12 +133,12 @@ Imports System, S = System.Linq Imports System.Collections.Generic - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System.Linq")) - End Sub + End Function - Public Sub TestImportsStatement_Remove1() + Public Async Function TestImportsStatement_Remove1() As Task Dim code = Imports System @@ -147,12 +148,12 @@ Imports System - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("System", Nothing)) - End Sub + End Function - Public Sub TestImportsStatement_Remove2() + Public Async Function TestImportsStatement_Remove2() As Task Dim code = Imports System.Linq @@ -166,12 +167,12 @@ Imports System Imports System.Collections.Generic - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("System.Linq", Nothing)) - End Sub + End Function - Public Sub TestImportsStatement_Remove3() + Public Async Function TestImportsStatement_Remove3() As Task Dim code = Imports System @@ -185,12 +186,12 @@ Imports System Imports System.Collections.Generic - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("System.Linq", Nothing)) - End Sub + End Function - Public Sub TestImportsStatement_Remove4() + Public Async Function TestImportsStatement_Remove4() As Task Dim code = Imports System @@ -204,12 +205,12 @@ Imports System Imports System.Collections.Generic - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("System.Linq", Nothing)) - End Sub + End Function - Public Sub TestImportsStatement_Remove5() + Public Async Function TestImportsStatement_Remove5() As Task Dim code = Imports System @@ -226,12 +227,12 @@ Imports System.Collections.Generic End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("System.Linq", Nothing), Remove("C", Nothing)) - End Sub + End Function - Public Sub TestImportsStatement_Remove6() + Public Async Function TestImportsStatement_Remove6() As Task Dim code = Imports System @@ -250,11 +251,11 @@ End Class ' Note: XML namespaces aren't supported by VB code model, so there should be no events when they're removed. - Test(code, changedCode) - End Sub + Await TestAsync(code, changedCode) + End Function - Public Sub TestImportsStatement_Rename1() + Public Async Function TestImportsStatement_Rename1() As Task Dim code = Imports System @@ -265,16 +266,16 @@ Imports System Imports System.Linq - Test(code, changedCode, + Await TestAsync(code, changedCode, Rename("System.Linq")) - End Sub + End Function #End Region #Region "Option statements" - Public Sub TestOptionsStatement_Add1() + Public Async Function TestOptionsStatement_Add1() As Task Dim code = @@ -284,12 +285,12 @@ Imports System.Linq Option Strict On - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("Option Strict On")) - End Sub + End Function - Public Sub TestOptionsStatement_Add2() + Public Async Function TestOptionsStatement_Add2() As Task Dim code = Option Strict On @@ -303,12 +304,12 @@ Option Strict On Option Infer On - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("Option Explicit On")) - End Sub + End Function - Public Sub TestOptionsStatement_Add3() + Public Async Function TestOptionsStatement_Add3() As Task Dim code = Option Strict On @@ -322,12 +323,12 @@ Option Explicit On Option Infer On - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("Option Explicit On")) - End Sub + End Function - Public Sub TestOptionsStatement_Add4() + Public Async Function TestOptionsStatement_Add4() As Task Dim code = Option Strict On @@ -341,12 +342,12 @@ Option Infer On Option Explicit On - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("Option Explicit On")) - End Sub + End Function - Public Sub TestOptionsStatement_Remove1() + Public Async Function TestOptionsStatement_Remove1() As Task Dim code = Option Strict On @@ -356,12 +357,12 @@ Option Strict On - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("Option Strict On", Nothing)) - End Sub + End Function - Public Sub TestOptionsStatement_Remove2() + Public Async Function TestOptionsStatement_Remove2() As Task Dim code = Option Explicit On @@ -375,12 +376,12 @@ Option Strict On Option Infer On - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("Option Explicit On", Nothing)) - End Sub + End Function - Public Sub TestOptionsStatement_Remove3() + Public Async Function TestOptionsStatement_Remove3() As Task Dim code = Option Strict On @@ -394,12 +395,12 @@ Option Strict On Option Infer On - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("Option Explicit On", Nothing)) - End Sub + End Function - Public Sub TestOptionsStatement_Remove4() + Public Async Function TestOptionsStatement_Remove4() As Task Dim code = Option Strict On @@ -413,12 +414,12 @@ Option Strict On Option Infer On - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("Option Explicit On", Nothing)) - End Sub + End Function - Public Sub TestOptionsStatement_Rename1() + Public Async Function TestOptionsStatement_Rename1() As Task Dim code = Option Strict On @@ -429,12 +430,12 @@ Option Strict On Option Strict Off - Test(code, changedCode, + Await TestAsync(code, changedCode, Rename("Option Strict Off")) - End Sub + End Function - Public Sub TestOptionsStatement_Rename2() + Public Async Function TestOptionsStatement_Rename2() As Task Dim code = Option Strict On @@ -445,12 +446,12 @@ Option Strict On Option Explicit On - Test(code, changedCode, + Await TestAsync(code, changedCode, Rename("Option Explicit On")) - End Sub + End Function - Public Sub TestOptionsStatement_Rename3() + Public Async Function TestOptionsStatement_Rename3() As Task ' Note: This represents a change from the legacy VB code model where ' the following test would result in Remove event being fired for "Option Strict On" ' rather than a resolve. However, this should be more expected in the Roslyn code model @@ -466,16 +467,16 @@ Option Strict On Option Strict Foo - Test(code, changedCode, + Await TestAsync(code, changedCode, Rename("Option Strict Foo")) - End Sub + End Function #End Region #Region "File-level attributes" - Public Sub TestFileLevelAttribute_Add1() + Public Async Function TestFileLevelAttribute_Add1() As Task Dim code = Imports System @@ -487,12 +488,12 @@ Imports System <Assembly: CLSCompliant(True)> - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("CLSCompliant")) - End Sub + End Function - Public Sub TestFileLevelAttribute_Add2() + Public Async Function TestFileLevelAttribute_Add2() As Task Dim code = Imports System @@ -510,12 +511,12 @@ Imports System.Reflection <Assembly: CLSCompliant(True)> - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("AssemblyTitle")) - End Sub + End Function - Public Sub TestFileLevelAttribute_Add3() + Public Async Function TestFileLevelAttribute_Add3() As Task Dim code = Imports System @@ -533,12 +534,12 @@ Imports System.Reflection <Assembly: AssemblyTitle("")> - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("AssemblyTitle")) - End Sub + End Function - Public Sub TestFileLevelAttribute_Add4() + Public Async Function TestFileLevelAttribute_Add4() As Task Dim code = Imports System @@ -555,12 +556,12 @@ Imports System.Reflection <Assembly: AssemblyTitle(""), Assembly: CLSCompliant(True)> - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("AssemblyTitle")) - End Sub + End Function - Public Sub TestFileLevelAttribute_Add5() + Public Async Function TestFileLevelAttribute_Add5() As Task Dim code = Imports System @@ -577,12 +578,12 @@ Imports System.Reflection <Assembly: CLSCompliant(True), Assembly: AssemblyTitle("")> - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("AssemblyTitle")) - End Sub + End Function - Public Sub TestFileLevelAttribute_ChangeSpecifier1() + Public Async Function TestFileLevelAttribute_ChangeSpecifier1() As Task Dim code = Imports System @@ -599,12 +600,12 @@ Imports System.Reflection <Module: CLSCompliant(True)> - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown("CLSCompliant")) - End Sub + End Function - Public Sub TestFileLevelAttribute_AddArgument1() + Public Async Function TestFileLevelAttribute_AddArgument1() As Task Dim code = Imports System @@ -621,13 +622,13 @@ Imports System.Reflection <Assembly: CLSCompliant(True)> - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("", "CLSCompliant"), ArgChange("CLSCompliant")) - End Sub + End Function - Public Sub TestFileLevelAttribute_RemoveArgument1() + Public Async Function TestFileLevelAttribute_RemoveArgument1() As Task Dim code = Imports System @@ -644,13 +645,13 @@ Imports System.Reflection <Assembly: CLSCompliant> - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("", "CLSCompliant"), ArgChange("CLSCompliant")) - End Sub + End Function - Public Sub TestFileLevelAttribute_OmitArgument1() + Public Async Function TestFileLevelAttribute_OmitArgument1() As Task Dim code = <Foo("hello", Baz:=True)> @@ -693,13 +694,13 @@ Class FooAttribute End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Change(CodeModelEventType.Rename Or CodeModelEventType.Unknown, ""), ArgChange("Foo")) - End Sub + End Function - Public Sub TestFileLevelAttribute_RenameArgument1() + Public Async Function TestFileLevelAttribute_RenameArgument1() As Task Dim code = Imports System @@ -716,13 +717,13 @@ Imports System.Reflection <Assembly: CLSCompliant(IsCompliant:=True)> - Test(code, changedCode, + Await TestAsync(code, changedCode, Rename("IsCompliant"), ArgChange("CLSCompliant")) - End Sub + End Function - Public Sub TestFileLevelAttribute_ChangeArgument1() + Public Async Function TestFileLevelAttribute_ChangeArgument1() As Task Dim code = Imports System @@ -739,13 +740,13 @@ Imports System.Reflection <Assembly: CLSCompliant(False)> - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown(""), ArgChange("CLSCompliant")) - End Sub + End Function - Public Sub TestFileLevelAttribute_ChangeArgument2() + Public Async Function TestFileLevelAttribute_ChangeArgument2() As Task Dim code = <Assembly: Foo("")> @@ -756,17 +757,17 @@ Imports System.Reflection <Assembly: Foo(0)> - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown(""), ArgChange("Foo")) - End Sub + End Function #End Region #Region "Namespaces" - Public Sub TestNamespace_Add1() + Public Async Function TestNamespace_Add1() As Task Dim code = @@ -776,12 +777,12 @@ Imports System.Reflection Namespace N - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("N")) - End Sub + End Function - Public Sub TestNamespace_Add2() + Public Async Function TestNamespace_Add2() As Task Dim code = @@ -792,12 +793,12 @@ Namespace N End Namespace - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("N")) - End Sub + End Function - Public Sub TestNamespace_Add3() + Public Async Function TestNamespace_Add3() As Task Dim code = Namespace N1 @@ -811,12 +812,12 @@ Namespace N1 End Namespace - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("N2", "N1")) - End Sub + End Function - Public Sub TestNamespace_Remove1() + Public Async Function TestNamespace_Remove1() As Task Dim code = Namespace N @@ -826,12 +827,12 @@ Namespace N - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("N", Nothing)) - End Sub + End Function - Public Sub TestNamespace_Remove2() + Public Async Function TestNamespace_Remove2() As Task Dim code = Namespace N @@ -842,12 +843,12 @@ End Namespace - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("N", Nothing)) - End Sub + End Function - Public Sub TestNamespace_Remove3() + Public Async Function TestNamespace_Remove3() As Task Dim code = Namespace N1 @@ -861,12 +862,12 @@ Namespace N1 End Namespace - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("N2", "N1")) - End Sub + End Function - Public Sub TestNamespace_Rename1() + Public Async Function TestNamespace_Rename1() As Task Dim code = Namespace N1 @@ -879,12 +880,12 @@ Namespace N2 End Namespace - Test(code, changedCode, + Await TestAsync(code, changedCode, Rename("N2")) - End Sub + End Function - Public Sub TestNamespace_Rename2() + Public Async Function TestNamespace_Rename2() As Task Dim code = Namespace N1 @@ -901,16 +902,16 @@ Namespace N1 End Namespace - Test(code, changedCode, + Await TestAsync(code, changedCode, Rename("N3")) - End Sub + End Function #End Region #Region "Classes" - Public Sub TestClass_Add1() + Public Async Function TestClass_Add1() As Task Dim code = @@ -921,12 +922,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("C")) - End Sub + End Function - Public Sub TestClass_Add2() + Public Async Function TestClass_Add2() As Task Dim code = Namespace N @@ -941,12 +942,12 @@ Namespace N End Namespace - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("C", "N")) - End Sub + End Function - Public Sub TestClass_Add3() + Public Async Function TestClass_Add3() As Task Dim code = Namespace N @@ -965,12 +966,12 @@ Namespace N End Namespace - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("C", "B")) - End Sub + End Function - Public Sub TestClass_Remove1() + Public Async Function TestClass_Remove1() As Task Dim code = Class C @@ -981,12 +982,12 @@ End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("C", Nothing)) - End Sub + End Function - Public Sub TestClass_Remove2() + Public Async Function TestClass_Remove2() As Task Dim code = Namespace N @@ -1001,12 +1002,12 @@ Namespace N End Namespace - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("C", "N")) - End Sub + End Function - Public Sub TestClass_Remove3() + Public Async Function TestClass_Remove3() As Task Dim code = Namespace N @@ -1025,12 +1026,12 @@ Namespace N End Namespace - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("C", "B")) - End Sub + End Function - Public Sub TestClass_ReplaceWithTwoClasses1() + Public Async Function TestClass_ReplaceWithTwoClasses1() As Task Dim code = Class D @@ -1046,12 +1047,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown(Nothing)) - End Sub + End Function - Public Sub TestClass_ReplaceWithTwoClasses2() + Public Async Function TestClass_ReplaceWithTwoClasses2() As Task Dim code = Namespace N @@ -1071,12 +1072,12 @@ Namespace N End Namespace - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown("N")) - End Sub + End Function - Public Sub TestClass_ChangeBaseList() + Public Async Function TestClass_ChangeBaseList() As Task Dim code = Namespace N @@ -1100,13 +1101,13 @@ Namespace N End Namespace - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("Inherits", "C"), BaseChange("C")) - End Sub + End Function - Public Sub TestClass_Rename1() + Public Async Function TestClass_Rename1() As Task Dim code = Class C @@ -1119,12 +1120,12 @@ Class D End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Rename("D")) - End Sub + End Function - Public Sub TestClass_Rename2() + Public Async Function TestClass_Rename2() As Task Dim code = Namespace N @@ -1141,12 +1142,12 @@ Namespace N End Namespace - Test(code, changedCode, + Await TestAsync(code, changedCode, Rename("D")) - End Sub + End Function - Public Sub TestClass_AddBaseClass() + Public Async Function TestClass_AddBaseClass() As Task Dim code = Class attr @@ -1159,17 +1160,17 @@ Class attr : Inherits Attribute End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("Inherits", "attr"), BaseChange("attr")) - End Sub + End Function #End Region #Region "Enums" - Public Sub TestEnum_Add1() + Public Async Function TestEnum_Add1() As Task Dim code = @@ -1180,12 +1181,12 @@ Enum Foo End Enum - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("Foo")) - End Sub + End Function - Public Sub TestEnum_Rename1() + Public Async Function TestEnum_Rename1() As Task Dim code = Enum Foo @@ -1198,16 +1199,16 @@ Enum Bar End Enum - Test(code, changedCode, + Await TestAsync(code, changedCode, Rename("Bar")) - End Sub + End Function #End Region #Region "Fields" - Public Sub TestField_Add1() + Public Async Function TestField_Add1() As Task Dim code = Class C @@ -1221,12 +1222,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("i", "C")) - End Sub + End Function - Public Sub TestField_Add2() + Public Async Function TestField_Add2() As Task Dim code = Class C @@ -1242,12 +1243,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("j", "C")) - End Sub + End Function - Public Sub TestField_Add3() + Public Async Function TestField_Add3() As Task Dim code = Class C @@ -1262,12 +1263,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("j", "C")) - End Sub + End Function - Public Sub TestField_Add4() + Public Async Function TestField_Add4() As Task Dim code = Class C @@ -1282,12 +1283,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("j", "C")) - End Sub + End Function - Public Sub TestField_Add5() + Public Async Function TestField_Add5() As Task Dim code = Class C @@ -1301,13 +1302,13 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("i", "C"), Add("j", "C")) - End Sub + End Function - Public Sub TestField_Remove1() + Public Async Function TestField_Remove1() As Task Dim code = Class C @@ -1321,12 +1322,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("i", "C")) - End Sub + End Function - Public Sub TestField_Remove2() + Public Async Function TestField_Remove2() As Task Dim code = Class C @@ -1342,12 +1343,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("j", "C")) - End Sub + End Function - Public Sub TestField_Remove3() + Public Async Function TestField_Remove3() As Task Dim code = Class C @@ -1362,12 +1363,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("j", "C")) - End Sub + End Function - Public Sub TestField_Remove4() + Public Async Function TestField_Remove4() As Task Dim code = Class C @@ -1382,12 +1383,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("j", "C")) - End Sub + End Function - Public Sub TestField_Remove5() + Public Async Function TestField_Remove5() As Task Dim code = Class C @@ -1401,14 +1402,14 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("i", "C"), Remove("j", "C")) - End Sub + End Function - Public Sub TestField_AddAttributeToField() + Public Async Function TestField_AddAttributeToField() As Task Dim code = Class C @@ -1424,13 +1425,13 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System.CLSCompliant", "foo")) - End Sub + End Function - Public Sub TestField_AddAttributeToTwoFields() + Public Async Function TestField_AddAttributeToTwoFields() As Task Dim code = Class C @@ -1446,14 +1447,14 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System.CLSCompliant", "foo"), Add("System.CLSCompliant", "bar")) - End Sub + End Function - Public Sub TestField_RemoveAttributeFromField() + Public Async Function TestField_RemoveAttributeFromField() As Task Dim code = Class C @@ -1469,13 +1470,13 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("System.CLSCompliant", "foo")) - End Sub + End Function - Public Sub TestField_RemoveAttributeFromTwoFields() + Public Async Function TestField_RemoveAttributeFromTwoFields() As Task Dim code = Class C @@ -1491,14 +1492,14 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("System.CLSCompliant", "foo"), Remove("System.CLSCompliant", "bar")) - End Sub + End Function - Public Sub TestField_ChangeAttributeOnField() + Public Async Function TestField_ChangeAttributeOnField() As Task Dim code = Class C @@ -1517,15 +1518,15 @@ End Class ' Unknown event fires for attribute argument and attribute ArgChange event fires for each field - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown(""), ArgChange("System.CLSCompliant")) - End Sub + End Function - Public Sub TestField_ChangeAttributeOnTwoFields() + Public Async Function TestField_ChangeAttributeOnTwoFields() As Task Dim code = Class C @@ -1544,15 +1545,15 @@ End Class ' Unknown event fires for attribute argument and attribute ArgChange event fires for each field - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown(""), ArgChange("System.CLSCompliant", "foo"), ArgChange("System.CLSCompliant", "bar")) - End Sub + End Function - Public Sub TestField_AddOneMoreAttribute() + Public Async Function TestField_AddOneMoreAttribute() As Task Dim code = Class C @@ -1568,14 +1569,14 @@ Class C Dim foo, bar As Integer End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("System.NonSerialized", "foo"), Add("System.NonSerialized", "bar")) - End Sub + End Function - Public Sub TestField_RemoveOneAttribute() + Public Async Function TestField_RemoveOneAttribute() As Task Dim code = Class C @@ -1590,17 +1591,17 @@ Class C Dim foo, bar As Integer End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("System.NonSerialized", "foo"), Remove("System.NonSerialized", "bar")) - End Sub + End Function #End Region #Region "Methods" - Public Sub TestMethod_Add1() + Public Async Function TestMethod_Add1() As Task Dim code = Class C @@ -1615,12 +1616,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("M", "C")) - End Sub + End Function - Public Sub TestMethod_Remove1() + Public Async Function TestMethod_Remove1() As Task Dim code = Class C @@ -1635,12 +1636,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("M", "C")) - End Sub + End Function - Public Sub TestMethod_RemoveOperator1() + Public Async Function TestMethod_RemoveOperator1() As Task Dim code = Class C @@ -1655,12 +1656,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("*", "C")) - End Sub + End Function - Public Sub TestMethod_ChangeType1() + Public Async Function TestMethod_ChangeType1() As Task Dim code = Class C @@ -1677,12 +1678,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, TypeRefChange("M")) - End Sub + End Function - Public Sub TestMethod_ChangeType2() + Public Async Function TestMethod_ChangeType2() As Task Dim code = Class C @@ -1699,16 +1700,16 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, TypeRefChange("M")) - End Sub + End Function #End Region #Region "Parameters" - Public Sub TestParameter_Add1() + Public Async Function TestParameter_Add1() As Task Dim code = Class C @@ -1725,12 +1726,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("i", "M")) - End Sub + End Function - Public Sub TestParameter_Add2() + Public Async Function TestParameter_Add2() As Task Dim code = Class C @@ -1747,12 +1748,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("j", "M")) - End Sub + End Function - Public Sub TestParameter_Remove1() + Public Async Function TestParameter_Remove1() As Task Dim code = Class C @@ -1769,12 +1770,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Remove("i", "M")) - End Sub + End Function - Public Sub TestParameter_ChangeModifier1() + Public Async Function TestParameter_ChangeModifier1() As Task Dim code = Class C @@ -1791,12 +1792,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown("i")) - End Sub + End Function - Public Sub TestParameter_ChangeModifier2() + Public Async Function TestParameter_ChangeModifier2() As Task Dim code = Class C @@ -1813,12 +1814,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Unknown("i")) - End Sub + End Function - Public Sub TestParameter_ChangeTypeToTypeCharacter() + Public Async Function TestParameter_ChangeTypeToTypeCharacter() As Task Dim code = Class C @@ -1835,12 +1836,12 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, TypeRefChange("b")) - End Sub + End Function - Public Sub TestParameter_ChangeTypeFromTypeCharacter() + Public Async Function TestParameter_ChangeTypeFromTypeCharacter() As Task Dim code = Class C @@ -1857,16 +1858,16 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, TypeRefChange("b")) - End Sub + End Function #End Region #Region "Attribute Arguments" - Public Sub Attribute_AddArgument1() + Public Async Function TestAttribute_AddArgument1() As Task Dim code = Imports System @@ -1887,13 +1888,13 @@ Class CAttribute End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("", "AttributeUsage"), ArgChange("AttributeUsage")) - End Sub + End Function - Public Sub Attribute_AddArgument2() + Public Async Function TestAttribute_AddArgument2() As Task Dim code = Imports System @@ -1914,17 +1915,17 @@ Class CAttribute End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Add("AllowMultiple", "AttributeUsage"), ArgChange("AttributeUsage")) - End Sub + End Function #End Region #Region "Other" - Public Sub RenameInterfaceMethod() + Public Async Function TestRenameInterfaceMethod() As Task Dim code = Interface IFoo @@ -1965,13 +1966,13 @@ Class C End Class - Test(code, changedCode, + Await TestAsync(code, changedCode, Rename("Baz")) - End Sub + End Function - Public Sub DontFireEventsForGarbage1() + Public Async Function TestDontFireEventsForGarbage1() As Task Dim code = Class C @@ -1992,12 +1993,12 @@ AddHandler button1.Click, Async Sub(sender, e) End Class - Test(code, changedCode) - End Sub + Await TestAsync(code, changedCode) + End Function - Public Sub DontFireEventsForGarbage2() + Public Async Function TestDontFireEventsForGarbage2() As Task Dim code = Partial Class SomeClass @@ -2026,12 +2027,12 @@ End Class Partial C - Test(code, changedCode) - End Sub + Await TestAsync(code, changedCode) + End Function - Public Sub ComparePropertyStatementBeforeMethodBase() + Public Async Function TestComparePropertyStatementBeforeMethodBase() As Task Dim code = Public MustInherit Class C1 @@ -2065,12 +2066,12 @@ Public MustInherit Class C1 End Class - Test(code, changedCode, Unknown("C1")) - End Sub + Await TestAsync(code, changedCode, Unknown("C1")) + End Function - Public Sub CompareEventStatementBeforeMethodBase() + Public Async Function TestCompareEventStatementBeforeMethodBase() As Task Dim code = Class Program @@ -2102,12 +2103,12 @@ Class Program End Event End Class - Test(code, changedCode, Unknown("Program")) - End Sub + Await TestAsync(code, changedCode, Unknown("Program")) + End Function - Public Sub CompareEventStatementBeforeMethodBase_WithMethods_1() + Public Async Function TestCompareEventStatementBeforeMethodBase_WithMethods_1() As Task Dim code = Class Program @@ -2144,12 +2145,12 @@ Class Program End Event End Class - Test(code, changedCode, Unknown("Program")) - End Sub + Await TestAsync(code, changedCode, Unknown("Program")) + End Function - Public Sub CompareEventStatementBeforeMethodBase_WithMethods_2() + Public Async Function TestCompareEventStatementBeforeMethodBase_WithMethods_2() As Task Dim code = Class Program @@ -2186,12 +2187,12 @@ Class Program End Event End Class - Test(code, changedCode, Unknown("Program")) - End Sub + Await TestAsync(code, changedCode, Unknown("Program")) + End Function - Public Sub CompareEventStatementBeforeMethodBase_WithMethods_3() + Public Async Function TestCompareEventStatementBeforeMethodBase_WithMethods_3() As Task Dim code = Class Program @@ -2228,12 +2229,12 @@ Class Program End Event End Class - Test(code, changedCode, Unknown("Program")) - End Sub + Await TestAsync(code, changedCode, Unknown("Program")) + End Function - Public Sub CompareMethodsOnly() + Public Async Function TestCompareMethodsOnly() As Task Dim code = Class Program @@ -2254,8 +2255,8 @@ Class Program End Sub End Class - Test(code, changedCode, Unknown("Program")) - End Sub + Await TestAsync(code, changedCode, Unknown("Program")) + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/ExternalCodeClassTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/ExternalCodeClassTests.vb index 34970af20d8af8c355d46a41238d67964bcbf51a..9f1dbbe62c79f2198a351650c204873c49054637 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/ExternalCodeClassTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/ExternalCodeClassTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Roslyn.Test.Utilities @@ -10,7 +11,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "Doc Comment" - Public Sub DocComment1() + Public Async Function TestDocComment1() As Task Dim code = ''' <summary>This is my comment!</summary> @@ -18,11 +19,11 @@ Class C$$ End Class - TestDocComment(code, "" & vbCrLf & " This is my comment!" & vbCrLf & "") - End Sub + Await TestDocComment(code, "" & vbCrLf & " This is my comment!" & vbCrLf & "") + End Function - Public Sub DocComment2() + Public Async Function TestDocComment2() As Task Dim code = ''' <summary>This is my comment!</summary> @@ -31,13 +32,13 @@ Class C$$ End Class - TestDocComment(code, "" & vbCrLf & " This is my comment!" & vbCrLf & " " & vbCrLf & "") - End Sub + Await TestDocComment(code, "" & vbCrLf & " This is my comment!" & vbCrLf & " " & vbCrLf & "") + End Function #End Region - Public Sub ExpectedClassMembers() + Public Async Function TestExpectedClassMembers() As Task Dim code = Class C$$ @@ -62,7 +63,7 @@ Class C$$ End Class - TestElement(code, + Await TestElement(code, Sub(codeElement) Dim members = codeElement.Members Assert.Equal(9, members.Count) @@ -103,10 +104,10 @@ End Class Assert.Equal("PublicM", member9.Name) Assert.Equal(EnvDTE.vsCMElement.vsCMElementFunction, member9.Kind) End Sub) - End Sub + End Function - Public Sub ClassMembersForWithEventsField_Private() + Public Async Function TestClassMembersForWithEventsField_Private() As Task Dim code = Class C @@ -123,7 +124,7 @@ Class D$$ End Class - TestElement(code, + Await TestElement(code, Sub(codeElement) Dim members = codeElement.Members Assert.Equal(2, members.Count) @@ -138,10 +139,10 @@ End Class Assert.Equal(EnvDTE.vsCMElement.vsCMElementVariable, member2.Kind) Assert.Equal(EnvDTE.vsCMAccess.vsCMAccessPrivate, CType(member2, EnvDTE.CodeVariable).Access) End Sub) - End Sub + End Function - Public Sub ClassMembersForWithEventsField_Protected() + Public Async Function TestClassMembersForWithEventsField_Protected() As Task Dim code = Class C @@ -158,7 +159,7 @@ Class D$$ End Class - TestElement(code, + Await TestElement(code, Sub(codeElement) Dim members = codeElement.Members Assert.Equal(3, members.Count) @@ -178,7 +179,7 @@ End Class Assert.Equal(EnvDTE.vsCMElement.vsCMElementVariable, member3.Kind) Assert.Equal(EnvDTE.vsCMAccess.vsCMAccessProtected Or EnvDTE.vsCMAccess.vsCMAccessWithEvents, CType(member3, EnvDTE.CodeVariable).Access) End Sub) - End Sub + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/FileCodeModelTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/FileCodeModelTests.vb index c313ce8744cbc4fd6db3c769ebebcaa6c6cb4c84..e750e0f084ae36bc13a3baadc090ae0d2ea9abc0 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/FileCodeModelTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/FileCodeModelTests.vb @@ -1,6 +1,7 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. Imports System.Threading +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces @@ -13,7 +14,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Inherits AbstractFileCodeModelTests - Public Sub TestEnumerationWithCountAndItem() + Public Async Function TestEnumerationWithCountAndItem() As Task Dim code = Namespace N @@ -29,7 +30,7 @@ Enum E End Enum Delegate Sub D() - Using workspaceAndFileCodeModel = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Using workspaceAndFileCodeModel = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim codeElements = workspaceAndFileCodeModel.FileCodeModel.CodeElements Dim count = codeElements.Count Assert.Equal(6, count) @@ -56,10 +57,10 @@ Delegate Sub D() j += 1 Next End Using - End Sub + End Function - Public Sub AssemblyLevelAttribute() + Public Async Function TestAssemblyLevelAttribute() As Task Dim code = <Assembly: Foo(0, True, S:="x")> @@ -81,7 +82,7 @@ Class FooAttribute End Class - Using workspaceAndFileCodeModel = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Using workspaceAndFileCodeModel = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim codeElements = workspaceAndFileCodeModel.FileCodeModel.CodeElements Dim count = codeElements.Count Assert.Equal(2, count) @@ -113,11 +114,11 @@ End Class Assert.Equal("S", arg3.Name) Assert.Equal("""x""", arg3.Value) End Using - End Sub + End Function - Public Sub CodeElementFullName() + Public Async Function TestCodeElementFullName() As Task Dim code = @@ -138,7 +139,7 @@ Namespace Outer End Namespace - Using workspaceAndFileCodeModel = CreateCodeModelTestState(code) + Using workspaceAndFileCodeModel = Await CreateCodeModelTestStateAsync(code) Dim codeElements = workspaceAndFileCodeModel.FileCodeModel.CodeElements Dim namespaceElement = TryCast(codeElements.Item(1), EnvDTE.CodeNamespace) @@ -175,27 +176,27 @@ End Namespace Assert.Equal("func1", func1.Name) Assert.Equal("BarBaz.Outer.Class1.func1", func1.FullName) End Using - End Sub + End Function #Region "AddAttribute tests" - Private Sub TestAddAttributeWithSimplification( - code As XElement, expectedCode As XElement, data As AttributeData, expectedUnsimplifiedName As String, expectedSimplifiedName As String) - TestAddAttributeWithSimplification(code, expectedCode, + Private Function TestAddAttributeWithSimplificationAsync( + code As XElement, expectedCode As XElement, data As AttributeData, expectedUnsimplifiedName As String, expectedSimplifiedName As String) As Task + Return TestAddAttributeWithSimplificationAsync(code, expectedCode, Sub(fileCodeModel, batch) Dim newAttribute = fileCodeModel.AddAttribute(data.Name, data.Value, data.Position) Assert.NotNull(newAttribute) Assert.Equal(If(batch, expectedUnsimplifiedName, expectedSimplifiedName), newAttribute.Name) End Sub) - End Sub + End Function - Protected Sub TestAddAttributeWithSimplification(code As XElement, expectedCode As XElement, testOperation As Action(Of EnvDTE.FileCodeModel, Boolean)) - TestAddAttributeWithBatchMode(code, expectedCode, testOperation, False) - TestAddAttributeWithBatchMode(code, expectedCode, testOperation, True) - End Sub + Protected Async Function TestAddAttributeWithSimplificationAsync(code As XElement, expectedCode As XElement, testOperation As Action(Of EnvDTE.FileCodeModel, Boolean)) As Task + Await TestAddAttributeWithBatchModeAsync(code, expectedCode, testOperation, False) + Await TestAddAttributeWithBatchModeAsync(code, expectedCode, testOperation, True) + End Function - Private Sub TestAddAttributeWithBatchMode(code As XElement, expectedCode As XElement, testOperation As Action(Of EnvDTE.FileCodeModel, Boolean), batch As Boolean) - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Private Async Function TestAddAttributeWithBatchModeAsync(code As XElement, expectedCode As XElement, testOperation As Action(Of EnvDTE.FileCodeModel, Boolean), batch As Boolean) As Task + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim fileCodeModel = state.FileCodeModel Assert.NotNull(fileCodeModel) @@ -212,10 +213,10 @@ End Namespace Dim text = state.GetDocumentAtCursor().GetTextAsync(CancellationToken.None).Result.ToString() Assert.Equal(expectedCode.NormalizedValue.Trim(), text.Trim()) End Using - End Sub + End Function - Public Sub AddAttribute1() + Public Async Function TestAddAttribute1() As Task Dim code = Class $$C @@ -229,11 +230,11 @@ Class C End Class - TestAddAttributeWithSimplification(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "True"}, "System.CLSCompliant", "CLSCompliant") - End Sub + Await TestAddAttributeWithSimplificationAsync(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "True"}, "System.CLSCompliant", "CLSCompliant") + End Function - Public Sub AddAttribute2() + Public Async Function TestAddAttribute2() As Task Dim code = Class $$C @@ -246,11 +247,11 @@ End Class Class C End Class - TestAddAttributeWithSimplification(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "True", .Position = "C"}, "System.CLSCompliant", "CLSCompliant") - End Sub + Await TestAddAttributeWithSimplificationAsync(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "True", .Position = "C"}, "System.CLSCompliant", "CLSCompliant") + End Function - Public Sub AddAttribute3() + Public Async Function TestAddAttribute3() As Task Dim code = $$<Assembly: System.Reflection.AssemblyCompany("Microsoft")> @@ -263,11 +264,11 @@ $$<Assembly: System.Reflection.AssemblyCompany("Microsoft")> - TestAddAttributeWithSimplification(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "True", .Position = -1}, "System.CLSCompliant", "CLSCompliant") - End Sub + Await TestAddAttributeWithSimplificationAsync(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "True", .Position = -1}, "System.CLSCompliant", "CLSCompliant") + End Function - Public Sub AddAttribute4() + Public Async Function TestAddAttribute4() As Task Dim code = $$<Assembly: System.Reflection.AssemblyCompany("Microsoft")> @@ -284,11 +285,11 @@ Class C End Class - TestAddAttributeWithSimplification(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "True", .Position = -1}, "System.CLSCompliant", "CLSCompliant") - End Sub + Await TestAddAttributeWithSimplificationAsync(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "True", .Position = -1}, "System.CLSCompliant", "CLSCompliant") + End Function - Public Sub AddAttribute5() + Public Async Function TestAddAttribute5() As Task Dim code = $$<Assembly: System.Reflection.AssemblyCompany("Microsoft")> @@ -306,11 +307,11 @@ End Class Class C End Class - TestAddAttributeWithSimplification(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "True", .Position = -1}, "System.CLSCompliant", "CLSCompliant") - End Sub + Await TestAddAttributeWithSimplificationAsync(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "True", .Position = -1}, "System.CLSCompliant", "CLSCompliant") + End Function - Public Sub AddAttribute6() + Public Async Function TestAddAttribute6() As Task Dim code = ''' <summary></summary> @@ -327,15 +328,15 @@ Class C End Class - TestAddAttributeWithSimplification(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "True"}, "System.CLSCompliant", "CLSCompliant") - End Sub + Await TestAddAttributeWithSimplificationAsync(code, expected, New AttributeData With {.Name = "System.CLSCompliant", .Value = "True"}, "System.CLSCompliant", "CLSCompliant") + End Function #End Region #Region "AddClass tests" - Public Sub AddClass1() + Public Async Function TestAddClass1() As Task Dim code = Class $$C @@ -351,11 +352,11 @@ Class C End Class - TestAddClass(code, expected, New ClassData With {.Name = "B"}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "B"}) + End Function - Public Sub AddClass2() + Public Async Function TestAddClass2() As Task Dim code = Class $$C : End Class @@ -369,11 +370,11 @@ End Class Class C : End Class - TestAddClass(code, expected, New ClassData With {.Name = "B"}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "B"}) + End Function - Public Sub AddClass3() + Public Async Function TestAddClass3() As Task Dim code = Class $$C @@ -389,11 +390,11 @@ Public Class B End Class - TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C"}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C"}) + End Function - Public Sub AddClass4() + Public Async Function TestAddClass4() As Task Dim code = Class $$C : End Class @@ -407,11 +408,11 @@ Public Class B End Class - TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C"}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C"}) + End Function - Public Sub AddClass5() + Public Async Function TestAddClass5() As Task Dim code = Class $$C @@ -428,11 +429,11 @@ Public Class B End Class - TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C", .Bases = {"C"}}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C", .Bases = {"C"}}) + End Function - Public Sub AddClass6() + Public Async Function TestAddClass6() As Task Dim code = Class $$C @@ -449,11 +450,11 @@ Public Class B End Class - TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C", .Bases = "C"}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "B", .Position = "C", .Bases = "C"}) + End Function - Public Sub AddClass7() + Public Async Function TestAddClass7() As Task Dim code = Interface $$I @@ -470,11 +471,11 @@ Public Class C End Class - TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "I", .Bases = {"I"}}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "I", .Bases = {"I"}}) + End Function - Public Sub AddClass8() + Public Async Function TestAddClass8() As Task Dim code = Interface $$I @@ -491,11 +492,11 @@ Public Class C End Class - TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "I", .Bases = "I"}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "I", .Bases = "I"}) + End Function - Public Sub AddClass9() + Public Async Function TestAddClass9() As Task Dim code = Class B : End Class @@ -513,11 +514,11 @@ Public Class C End Class - TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "I", .Bases = "B", .ImplementedInterfaces = "I"}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "I", .Bases = "B", .ImplementedInterfaces = "I"}) + End Function - Public Sub AddClass10() + Public Async Function TestAddClass10() As Task Dim code = Class B : End Class @@ -537,15 +538,15 @@ Public Class C End Class - TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "IBar", .Bases = "B", .ImplementedInterfaces = {"IFoo", "IBar"}}) - End Sub + Await TestAddClass(code, expected, New ClassData With {.Name = "C", .Position = "IBar", .Bases = "B", .ImplementedInterfaces = {"IFoo", "IBar"}}) + End Function #End Region #Region "AddImport tests" - Public Sub AddImport1() + Public Async Function TestAddImport1() As Task Dim code = Class $$C @@ -559,11 +560,11 @@ Class C End Class - TestAddImport(code, expected, New ImportData With {.[Namespace] = "System"}) - End Sub + Await TestAddImport(code, expected, New ImportData With {.[Namespace] = "System"}) + End Function - Public Sub AddImport2() + Public Async Function TestAddImport2() As Task Dim code = Class $$C @@ -577,11 +578,11 @@ Class C End Class - TestAddImport(code, expected, New ImportData With {.[Namespace] = "System", .Alias = "S"}) - End Sub + Await TestAddImport(code, expected, New ImportData With {.[Namespace] = "System", .Alias = "S"}) + End Function - Public Sub AddImport3() + Public Async Function TestAddImport3() As Task Dim code = Imports System.Collections.Generic @@ -599,11 +600,11 @@ Class C End Class - TestAddImport(code, expected, New ImportData With {.[Namespace] = "System"}) - End Sub + Await TestAddImport(code, expected, New ImportData With {.[Namespace] = "System"}) + End Function - Public Sub AddImport4() + Public Async Function TestAddImport4() As Task Dim code = Imports System.Collections.Generic @@ -621,15 +622,15 @@ Class C End Class - TestAddImport(code, expected, New ImportData With {.[Namespace] = "System", .Position = -1}) - End Sub + Await TestAddImport(code, expected, New ImportData With {.[Namespace] = "System", .Position = -1}) + End Function #End Region #Region "AddNamespace tests" - Public Sub AddNamespace1() + Public Async Function TestAddNamespace1() As Task Dim code = Class $$C @@ -645,11 +646,11 @@ Class C End Class - TestAddNamespace(code, expected, New NamespaceData With {.Name = "N"}) - End Sub + Await TestAddNamespace(code, expected, New NamespaceData With {.Name = "N"}) + End Function - Public Sub AddNamespace2() + Public Async Function TestAddNamespace2() As Task Dim code = Class $$C @@ -665,11 +666,11 @@ Class C End Class - TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = 0}) - End Sub + Await TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = 0}) + End Function - Public Sub AddNamespace3() + Public Async Function TestAddNamespace3() As Task Dim code = Class $$C @@ -685,11 +686,11 @@ Namespace N End Namespace - TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = "C"}) - End Sub + Await TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = "C"}) + End Function - Public Sub AddNamespace4() + Public Async Function TestAddNamespace4() As Task Dim code = $$ @@ -699,11 +700,11 @@ Namespace N End Namespace - TestAddNamespace(code, expected, New NamespaceData With {.Name = "N"}) - End Sub + Await TestAddNamespace(code, expected, New NamespaceData With {.Name = "N"}) + End Function - Public Sub AddNamespace5() + Public Async Function TestAddNamespace5() As Task Dim code = $$Imports System @@ -717,11 +718,11 @@ Namespace N End Namespace - TestAddNamespace(code, expected, New NamespaceData With {.Name = "N"}) - End Sub + Await TestAddNamespace(code, expected, New NamespaceData With {.Name = "N"}) + End Function - Public Sub AddNamespace6() + Public Async Function TestAddNamespace6() As Task Dim code = $$Imports System @@ -735,10 +736,10 @@ Namespace N End Namespace - TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = 0}) - End Sub + Await TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = 0}) + End Function - Public Sub AddNamespace7() + Public Async Function TestAddNamespace7() As Task Dim code = $$Imports System @@ -752,20 +753,20 @@ Namespace N End Namespace - TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = Type.Missing}) - End Sub + Await TestAddNamespace(code, expected, New NamespaceData With {.Name = "N", .Position = Type.Missing}) + End Function #End Region - Public Sub TestClass() + Public Async Function TestClass() As Task Dim code = Class C End Class - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim codeElements = state.FileCodeModel.CodeElements Assert.Equal(1, codeElements.Count) @@ -779,10 +780,10 @@ End Class Assert.Equal(2, codeClass.EndPoint.Line) Assert.Equal(10, codeClass.EndPoint.LineCharOffset) End Using - End Sub + End Function - Public Sub TestClassWithTopLevelJunk() + Public Async Function TestClassWithTopLevelJunk() As Task Dim code = Class C @@ -790,7 +791,7 @@ End Class A - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim codeElements = state.FileCodeModel.CodeElements Assert.Equal(1, codeElements.Count) @@ -804,10 +805,10 @@ A Assert.Equal(2, codeClass.EndPoint.Line) Assert.Equal(10, codeClass.EndPoint.LineCharOffset) End Using - End Sub + End Function - Public Sub TestClassNavigatePoints() + Public Async Function TestClassNavigatePoints() As Task Dim code = Class B @@ -819,7 +820,7 @@ Class C End Class - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim codeElements = state.FileCodeModel.CodeElements Assert.Equal(2, codeElements.Count) @@ -840,11 +841,11 @@ End Class Assert.Equal(6, startPointC.Line) Assert.Equal(5, startPointC.LineCharOffset) End Using - End Sub + End Function - Public Sub TestOptionStatement() + Public Async Function TestOptionStatement() As Task Dim code = Option Explicit On @@ -853,7 +854,7 @@ Class C End Class - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(code)) + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(code)) Dim codeElements = state.FileCodeModel.CodeElements Assert.Equal(2, codeElements.Count) @@ -866,12 +867,12 @@ End Class Assert.NotNull(codeClassC) Assert.Equal("C", codeClassC.Name) End Using - End Sub + End Function #Region "Remove tests" - Public Sub Remove1() + Public Async Function TestRemove1() As Task Dim code = Class $$C @@ -882,11 +883,11 @@ End Class - TestRemoveChild(code, expected, "C") - End Sub + Await TestRemoveChild(code, expected, "C") + End Function - Public Sub Remove2() + Public Async Function TestRemove2() As Task Dim code = ''' <summary> @@ -900,14 +901,14 @@ End Class - TestRemoveChild(code, expected, "C") - End Sub + Await TestRemoveChild(code, expected, "C") + End Function #End Region - Public Sub OutsideEditsFormattedAfterEndBatch() - Using state = CreateCodeModelTestState(GetWorkspaceDefinition(Class C : End Class)) + Public Async Function TestOutsideEditsFormattedAfterEndBatch() As Task + Using state = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(Class C : End Class)) Dim fileCodeModel = state.FileCodeModel Assert.NotNull(fileCodeModel) @@ -922,20 +923,20 @@ End Class Assert.Contains("Class C", buffer.CurrentSnapshot.GetText(), StringComparison.Ordinal) End Using - End Sub + End Function - Public Sub ChangeClassNameAndGetNameOfChildFunction() + Public Async Function ChangeClassNameAndGetNameOfChildFunction() As Task Dim code = - + Class C Sub M() End Sub End Class - TestOperation(code, + Await TestOperation(code, Sub(fileCodeModel) Dim codeClass = TryCast(fileCodeModel.CodeElements.Item(1), EnvDTE.CodeClass) Assert.NotNull(codeClass) @@ -949,40 +950,40 @@ End Class Assert.Equal("NewClassName", codeClass.Name) Assert.Equal("M", codeFunction.Name) End Sub) - End Sub + End Function - Public Sub CreateUnknownElementForDeclarationFunctionAndSub() + Public Async Function CreateUnknownElementForDeclarationFunctionAndSub() As Task Dim oldCode = - + Public Class Class1 Public Declare Sub f1 Lib "MyLib.dll" () Public Declare Function f2 Lib "MyLib.dll" () As Integer End Class Dim changedCodeRemoveFunction = - + Public Class Class1 Public Declare Sub f1 Lib "MyLib.dll" () End Class Dim changedCodeSubFunction = - + Public Class Class1 Public Declare Function f2 Lib "MyLib.dll" () As Integer End Class Dim changedDefinition = - - CommonReferences="true"> - <%= changedCodeRemoveFunction.Value %> - <%= changedCodeSubFunction.Value %> - - - - Using originalWorkspaceAndFileCodeModel = CreateCodeModelTestState(GetWorkspaceDefinition(oldCode)) + + CommonReferences="true"> + <%= changedCodeRemoveFunction.Value %> + <%= changedCodeSubFunction.Value %> + + + + Using originalWorkspaceAndFileCodeModel = Await CreateCodeModelTestStateAsync(GetWorkspaceDefinition(oldCode)) Using changedworkspace = TestWorkspaceFactory.CreateWorkspace(changedDefinition, exportProvider:=VisualStudioTestExportProvider.ExportProvider) Dim originalDocument = originalWorkspaceAndFileCodeModel.Workspace.CurrentSolution.GetDocument(originalWorkspaceAndFileCodeModel.Workspace.Documents(0).Id) @@ -1021,13 +1022,13 @@ End Class End Using End Using - End Sub + End Function - Public Sub TestCodeElements_InheritsStatements() + Public Async Function TestCodeElements_InheritsStatements() As Task Dim code = - + Class A End Class @@ -1036,44 +1037,44 @@ Class C End Class - TestOperation(code, - Sub(fileCodeModel) - Dim classC = TryCast(fileCodeModel.CodeElements.Item(2), EnvDTE.CodeClass) - Assert.NotNull(classC) - Assert.Equal("C", classC.Name) - - Dim inheritsA = TryCast(classC.Children.Item(1), EnvDTE80.CodeElement2) - Assert.NotNull(inheritsA) - - Dim parent = TryCast(inheritsA.Collection.Parent, EnvDTE.CodeClass) - Assert.NotNull(parent) - Assert.Equal("C", parent.Name) - - ' This assert is very important! - ' - ' We are testing that we don't regress a bug where the VB Inherits statement creates its - ' parent incorrectly such that *existing* Code Model objects for its parent ("C") get a different - ' NodeKey that makes the existing objects invalid. If the bug regresses, the line below will - ' fail with an ArguementException when trying to use classC's NodeKey to lookup its node. - ' (Essentially, its NodeKey will be {C,2} rather than {C,1}). - Assert.Equal("C", classC.Name) - - ' Sanity: ensure that the NodeKeys are correct - Dim member1 = ComAggregate.GetManagedObject(Of AbstractCodeMember)(parent) - Dim member2 = ComAggregate.GetManagedObject(Of AbstractCodeMember)(classC) - - Assert.Equal("C", member1.NodeKey.Name) - Assert.Equal(1, member1.NodeKey.Ordinal) - Assert.Equal("C", member2.NodeKey.Name) - Assert.Equal(1, member2.NodeKey.Ordinal) - End Sub) - End Sub + Await TestOperation(code, + Sub(fileCodeModel) + Dim classC = TryCast(fileCodeModel.CodeElements.Item(2), EnvDTE.CodeClass) + Assert.NotNull(classC) + Assert.Equal("C", classC.Name) + + Dim inheritsA = TryCast(classC.Children.Item(1), EnvDTE80.CodeElement2) + Assert.NotNull(inheritsA) + + Dim parent = TryCast(inheritsA.Collection.Parent, EnvDTE.CodeClass) + Assert.NotNull(parent) + Assert.Equal("C", parent.Name) + + ' This assert is very important! + ' + ' We are testing that we don't regress a bug where the VB Inherits statement creates its + ' parent incorrectly such that *existing* Code Model objects for its parent ("C") get a different + ' NodeKey that makes the existing objects invalid. If the bug regresses, the line below will + ' fail with an ArguementException when trying to use classC's NodeKey to lookup its node. + ' (Essentially, its NodeKey will be {C,2} rather than {C,1}). + Assert.Equal("C", classC.Name) + + ' Sanity: ensure that the NodeKeys are correct + Dim member1 = ComAggregate.GetManagedObject(Of AbstractCodeMember)(parent) + Dim member2 = ComAggregate.GetManagedObject(Of AbstractCodeMember)(classC) + + Assert.Equal("C", member1.NodeKey.Name) + Assert.Equal(1, member1.NodeKey.Ordinal) + Assert.Equal("C", member2.NodeKey.Name) + Assert.Equal(1, member2.NodeKey.Ordinal) + End Sub) + End Function - Public Sub TestCodeElements_ImplementsStatements() + Public Async Function TestCodeElements_ImplementsStatements() As Task Dim code = - + Interface I End Interface @@ -1082,44 +1083,44 @@ Class C End Class - TestOperation(code, - Sub(fileCodeModel) - Dim classC = TryCast(fileCodeModel.CodeElements.Item(2), EnvDTE.CodeClass) - Assert.NotNull(classC) - Assert.Equal("C", classC.Name) - - Dim implementsI = TryCast(classC.Children.Item(1), EnvDTE80.CodeElement2) - Assert.NotNull(implementsI) - - Dim parent = TryCast(implementsI.Collection.Parent, EnvDTE.CodeClass) - Assert.NotNull(parent) - Assert.Equal("C", parent.Name) - - ' This assert is very important! - ' - ' We are testing that we don't regress a bug where the VB Implements statement creates its - ' parent incorrectly such that *existing* Code Model objects for its parent ("C") get a different - ' NodeKey that makes the existing objects invalid. If the bug regresses, the line below will - ' fail with an ArguementException when trying to use classC's NodeKey to lookup its node. - ' (Essentially, its NodeKey will be {C,2} rather than {C,1}). - Assert.Equal("C", classC.Name) - - ' Sanity: ensure that the NodeKeys are correct - Dim member1 = ComAggregate.GetManagedObject(Of AbstractCodeMember)(parent) - Dim member2 = ComAggregate.GetManagedObject(Of AbstractCodeMember)(classC) - - Assert.Equal("C", member1.NodeKey.Name) - Assert.Equal(1, member1.NodeKey.Ordinal) - Assert.Equal("C", member2.NodeKey.Name) - Assert.Equal(1, member2.NodeKey.Ordinal) - End Sub) - End Sub + Await TestOperation(code, + Sub(fileCodeModel) + Dim classC = TryCast(fileCodeModel.CodeElements.Item(2), EnvDTE.CodeClass) + Assert.NotNull(classC) + Assert.Equal("C", classC.Name) + + Dim implementsI = TryCast(classC.Children.Item(1), EnvDTE80.CodeElement2) + Assert.NotNull(implementsI) + + Dim parent = TryCast(implementsI.Collection.Parent, EnvDTE.CodeClass) + Assert.NotNull(parent) + Assert.Equal("C", parent.Name) + + ' This assert is very important! + ' + ' We are testing that we don't regress a bug where the VB Implements statement creates its + ' parent incorrectly such that *existing* Code Model objects for its parent ("C") get a different + ' NodeKey that makes the existing objects invalid. If the bug regresses, the line below will + ' fail with an ArguementException when trying to use classC's NodeKey to lookup its node. + ' (Essentially, its NodeKey will be {C,2} rather than {C,1}). + Assert.Equal("C", classC.Name) + + ' Sanity: ensure that the NodeKeys are correct + Dim member1 = ComAggregate.GetManagedObject(Of AbstractCodeMember)(parent) + Dim member2 = ComAggregate.GetManagedObject(Of AbstractCodeMember)(classC) + + Assert.Equal("C", member1.NodeKey.Name) + Assert.Equal(1, member1.NodeKey.Ordinal) + Assert.Equal("C", member2.NodeKey.Name) + Assert.Equal(1, member2.NodeKey.Ordinal) + End Sub) + End Function - Public Sub TestCodeElements_PropertyAccessor() + Public Async Function TestCodeElements_PropertyAccessor() As Task Dim code = - + Class C ReadOnly Property P As Integer Get @@ -1128,50 +1129,50 @@ Class C End Class - TestOperation(code, - Sub(fileCodeModel) - Dim classC = TryCast(fileCodeModel.CodeElements.Item(1), EnvDTE.CodeClass) - Assert.NotNull(classC) - Assert.Equal("C", classC.Name) - - Dim propertyP = TryCast(classC.Members.Item(1), EnvDTE.CodeProperty) - Assert.NotNull(propertyP) - Assert.Equal("P", propertyP.Name) - - Dim getter = propertyP.Getter - Assert.NotNull(getter) - - Dim searchedGetter = fileCodeModel.CodeElementFromPoint(getter.StartPoint, EnvDTE.vsCMElement.vsCMElementFunction) - - Dim parent = TryCast(getter.Collection.Parent, EnvDTE.CodeProperty) - Assert.NotNull(parent) - Assert.Equal("P", parent.Name) - - ' This assert is very important! - ' - ' We are testing that we don't regress a bug where a property accessor creates its - ' parent incorrectly such that *existing* Code Model objects for its parent ("P") get a different - ' NodeKey that makes the existing objects invalid. If the bug regresses, the line below will - ' fail with an ArguementException when trying to use propertyP's NodeKey to lookup its node. - ' (Essentially, its NodeKey will be {C.P As Integer,2} rather than {C.P As Integer,1}). - Assert.Equal("P", propertyP.Name) - - ' Sanity: ensure that the NodeKeys are correct - Dim member1 = ComAggregate.GetManagedObject(Of AbstractCodeMember)(parent) - Dim member2 = ComAggregate.GetManagedObject(Of AbstractCodeMember)(propertyP) - - Assert.Equal("C.P As Integer", member1.NodeKey.Name) - Assert.Equal(1, member1.NodeKey.Ordinal) - Assert.Equal("C.P As Integer", member2.NodeKey.Name) - Assert.Equal(1, member2.NodeKey.Ordinal) - End Sub) - End Sub + Await TestOperation(code, + Sub(fileCodeModel) + Dim classC = TryCast(fileCodeModel.CodeElements.Item(1), EnvDTE.CodeClass) + Assert.NotNull(classC) + Assert.Equal("C", classC.Name) + + Dim propertyP = TryCast(classC.Members.Item(1), EnvDTE.CodeProperty) + Assert.NotNull(propertyP) + Assert.Equal("P", propertyP.Name) + + Dim getter = propertyP.Getter + Assert.NotNull(getter) + + Dim searchedGetter = fileCodeModel.CodeElementFromPoint(getter.StartPoint, EnvDTE.vsCMElement.vsCMElementFunction) + + Dim parent = TryCast(getter.Collection.Parent, EnvDTE.CodeProperty) + Assert.NotNull(parent) + Assert.Equal("P", parent.Name) + + ' This assert is very important! + ' + ' We are testing that we don't regress a bug where a property accessor creates its + ' parent incorrectly such that *existing* Code Model objects for its parent ("P") get a different + ' NodeKey that makes the existing objects invalid. If the bug regresses, the line below will + ' fail with an ArguementException when trying to use propertyP's NodeKey to lookup its node. + ' (Essentially, its NodeKey will be {C.P As Integer,2} rather than {C.P As Integer,1}). + Assert.Equal("P", propertyP.Name) + + ' Sanity: ensure that the NodeKeys are correct + Dim member1 = ComAggregate.GetManagedObject(Of AbstractCodeMember)(parent) + Dim member2 = ComAggregate.GetManagedObject(Of AbstractCodeMember)(propertyP) + + Assert.Equal("C.P As Integer", member1.NodeKey.Name) + Assert.Equal(1, member1.NodeKey.Ordinal) + Assert.Equal("C.P As Integer", member2.NodeKey.Name) + Assert.Equal(1, member2.NodeKey.Ordinal) + End Sub) + End Function - Public Sub TestCodeElements_EventAccessor() + Public Async Function TestCodeElements_EventAccessor() As Task Dim code = - + Class C Custom Event E As System.EventHandler AddHandler(value As System.EventHandler) @@ -1187,7 +1188,7 @@ Class C End Class - TestOperation(code, + Await TestOperation(code, Sub(fileCodeModel) Dim classC = TryCast(fileCodeModel.CodeElements.Item(1), EnvDTE.CodeClass) Assert.NotNull(classC) @@ -1224,7 +1225,7 @@ End Class Assert.Equal("C.E As System.EventHandler", member2.NodeKey.Name) Assert.Equal(1, member2.NodeKey.Ordinal) End Sub) - End Sub + End Function Protected Overrides ReadOnly Property LanguageName As String Get diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/ImplementsStatementTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/ImplementsStatementTests.vb index d1bb3d4f3c937b84168474b555c07a8be203dc3b..92207ae4064ec53432f9984afaf8bec5b42ffd8a 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/ImplementsStatementTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/ImplementsStatementTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Text Imports Roslyn.Test.Utilities @@ -11,7 +12,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "GetStartPoint() tests" - Public Sub GetStartPoint1() + Public Async Function TestGetStartPoint1() As Task Dim code = Interface I @@ -22,7 +23,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -43,14 +44,14 @@ End Class TextPoint(line:=5, lineOffset:=5, absoluteOffset:=40, lineLength:=16)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=5, lineOffset:=5, absoluteOffset:=40, lineLength:=16))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint1() + Public Async Function TestGetEndPoint1() As Task Dim code = Interface I @@ -61,7 +62,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -82,14 +83,14 @@ End Class TextPoint(line:=5, lineOffset:=17, absoluteOffset:=52, lineLength:=16)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=5, lineOffset:=17, absoluteOffset:=52, lineLength:=16))) - End Sub + End Function #End Region #Region "Kind tests" - Public Sub Kind() + Public Async Function TestKind1() As Task Dim code = Interface I @@ -100,15 +101,15 @@ Class C End Class - TestKind(code, EnvDTE.vsCMElement.vsCMElementImplementsStmt) - End Sub + Await TestKind(code, EnvDTE.vsCMElement.vsCMElementImplementsStmt) + End Function #End Region #Region "Name tests" - Public Sub Name1() + Public Async Function TestName1() As Task Dim code = Interface I @@ -119,8 +120,8 @@ Class C End Class - TestName(code, "Implements") - End Sub + Await TestName(code, "Implements") + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/InheritsStatementTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/InheritsStatementTests.vb index c64744aaa02e60b4a3cb0e0aafea98c209649367..3642425c4d4c01a70057cff107424b9b1bb54758 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/InheritsStatementTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/InheritsStatementTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Text Imports Roslyn.Test.Utilities @@ -11,7 +12,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "GetStartPoint() tests" - Public Sub GetStartPoint1() + Public Async Function TestGetStartPoint1() As Task Dim code = Class B @@ -22,7 +23,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -43,14 +44,14 @@ End Class TextPoint(line:=5, lineOffset:=5, absoluteOffset:=32, lineLength:=14)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=5, lineOffset:=5, absoluteOffset:=32, lineLength:=14))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint1() + Public Async Function TestGetEndPoint1() As Task Dim code = Class B @@ -61,7 +62,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -82,14 +83,14 @@ End Class TextPoint(line:=5, lineOffset:=15, absoluteOffset:=42, lineLength:=14)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=5, lineOffset:=15, absoluteOffset:=42, lineLength:=14))) - End Sub + End Function #End Region #Region "Kind tests" - Public Sub Kind() + Public Async Function TestKind1() As Task Dim code = Class B @@ -100,15 +101,15 @@ Class C End Class - TestKind(code, EnvDTE.vsCMElement.vsCMElementInheritsStmt) - End Sub + Await TestKind(code, EnvDTE.vsCMElement.vsCMElementInheritsStmt) + End Function #End Region #Region "Name tests" - Public Sub Name1() + Public Async Function TestName1() As Task Dim code = Class B @@ -119,8 +120,8 @@ Class C End Class - TestName(code, "Inherits") - End Sub + Await TestName(code, "Inherits") + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/OptionsStatementTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/OptionsStatementTests.vb index 1707549043c1ad44f30a1cb73f59bd32f56489e4..c14776575788083d31290ac9a0df183db4b07efc 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/OptionsStatementTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/OptionsStatementTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Text Imports Roslyn.Test.Utilities @@ -11,7 +12,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "GetStartPoint() tests" - Public Sub GetStartPoint1() + Public Async Function TestGetStartPoint1() As Task Dim code = Option $$Strict On @@ -20,7 +21,7 @@ Class C End Class - TestGetStartPoint(code, + Await TestGetStartPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -41,14 +42,14 @@ End Class TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=16)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=1, absoluteOffset:=1, lineLength:=16))) - End Sub + End Function #End Region #Region "GetEndPoint() tests" - Public Sub GetEndPoint1() + Public Async Function TestGetEndPoint1() As Task Dim code = Option $$Strict On @@ -57,7 +58,7 @@ Class C End Class - TestGetEndPoint(code, + Await TestGetEndPoint(code, Part(EnvDTE.vsCMPart.vsCMPartAttributes, NullTextPoint), Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter, @@ -78,35 +79,35 @@ End Class TextPoint(line:=1, lineOffset:=17, absoluteOffset:=17, lineLength:=16)), Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes, TextPoint(line:=1, lineOffset:=17, absoluteOffset:=17, lineLength:=16))) - End Sub + End Function #End Region #Region "Kind tests" - Public Sub Kind() + Public Async Function TestKind1() As Task Dim code = $$Option Strict On - TestKind(code, EnvDTE.vsCMElement.vsCMElementOptionStmt) - End Sub + Await TestKind(code, EnvDTE.vsCMElement.vsCMElementOptionStmt) + End Function #End Region #Region "Name tests" - Public Sub Name1() + Public Async Function TestName1() As Task Dim code = $$Option Strict On - TestName(code, "Option Strict On") - End Sub + Await TestName(code, "Option Strict On") + End Function #End Region diff --git a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/RootCodeModelTests.vb b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/RootCodeModelTests.vb index f248156ca43cf1ec5fab980860e8743ea5664ed5..9fde3b25238898e699258e293bbccedb3def1b9f 100644 --- a/src/VisualStudio/Core/Test/CodeModel/VisualBasic/RootCodeModelTests.vb +++ b/src/VisualStudio/Core/Test/CodeModel/VisualBasic/RootCodeModelTests.vb @@ -1,5 +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. +Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel Imports Microsoft.VisualStudio.LanguageServices.Implementation.Interop @@ -12,63 +13,63 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasi #Region "CodeElements tests" - Public Sub CodeElements1() + Public Async Function TestCodeElements1() As Task Dim code = Class Foo End Class - TestCodeElements(code, "MS", "My", "Microsoft", "System", "Foo") - End Sub + Await TestCodeElements(code, "MS", "My", "Microsoft", "System", "Foo") + End Function - Public Sub CodeElements2() + Public Async Function TestCodeElements2() As Task Dim code = Module Foo End Module - TestCodeElements(code, "MS", "My", "Microsoft", "System", "Foo") - End Sub + Await TestCodeElements(code, "MS", "My", "Microsoft", "System", "Foo") + End Function #End Region #Region "CreateCodeTypeRef" - Public Sub CreateCodeTypeRef_Int32() - TestCreateCodeTypeRef("System.Int32", + Public Async Function TestCreateCodeTypeRef_Int32() As Task + Await TestCreateCodeTypeRef("System.Int32", New CodeTypeRefData With { .AsString = "Integer", .AsFullName = "System.Int32", .CodeTypeFullName = "System.Int32", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefInt }) - End Sub + End Function - Public Sub CreateCodeTypeRef_System_Text_StringBuilder() - TestCreateCodeTypeRef("System.Text.StringBuilder", + Public Async Function TestCreateCodeTypeRef_System_Text_StringBuilder() As Task + Await TestCreateCodeTypeRef("System.Text.StringBuilder", New CodeTypeRefData With { .AsString = "System.Text.StringBuilder", .AsFullName = "System.Text.StringBuilder", .CodeTypeFullName = "System.Text.StringBuilder", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType }) - End Sub + End Function - Public Sub CreateCodeTypeRef_NullableInteger() - TestCreateCodeTypeRef("Integer?", + Public Async Function TestCreateCodeTypeRef_NullableInteger() As Task + Await TestCreateCodeTypeRef("Integer?", New CodeTypeRefData With { .AsString = "Integer?", .AsFullName = "System.Nullable(Of System.Int32)", .CodeTypeFullName = "System.Nullable(Of System.Int32)", .TypeKind = EnvDTE.vsCMTypeRef.vsCMTypeRefCodeType }) - End Sub + End Function #End Region @@ -76,7 +77,7 @@ End Module - Public Sub TestCodeTypeFromFullName_NonGenerated() + Public Async Function TestCodeTypeFromFullName_NonGenerated() As Task Dim workspace = CommonReferences="true"> @@ -89,7 +90,7 @@ End Namespace - TestCodeTypeFromFullName(workspace, "N.C", + Await TestCodeTypeFromFullName(workspace, "N.C", Sub(codeType) Assert.NotNull(codeType) Assert.Equal("N.C", codeType.FullName) @@ -107,12 +108,12 @@ End Namespace Assert.Equal("C.vb", filePath) End Sub) - End Sub + End Function - Public Sub TestCodeTypeFromFullName_Generated() + Public Async Function TestCodeTypeFromFullName_Generated() As Task Dim workspace = CommonReferences="true"> @@ -125,7 +126,7 @@ End Namespace - TestCodeTypeFromFullName(workspace, "N.C", + Await TestCodeTypeFromFullName(workspace, "N.C", Sub(codeType) Assert.NotNull(codeType) Assert.Equal("N.C", codeType.FullName) @@ -143,11 +144,11 @@ End Namespace Assert.Equal("C.g.vb", filePath) End Sub) - End Sub + End Function - Public Sub TestCodeTypeFromFullName_NonGenerated_Generated() + Public Async Function TestCodeTypeFromFullName_NonGenerated_Generated() As Task Dim workspace = CommonReferences="true"> @@ -166,7 +167,7 @@ End Namespace - TestCodeTypeFromFullName(workspace, "N.C", + Await TestCodeTypeFromFullName(workspace, "N.C", Sub(codeType) Assert.NotNull(codeType) Assert.Equal("N.C", codeType.FullName) @@ -184,11 +185,11 @@ End Namespace Assert.Equal("C.vb", filePath) End Sub) - End Sub + End Function - Public Sub TestCodeTypeFromFullName_Generated_NonGenerated() + Public Async Function TestCodeTypeFromFullName_Generated_NonGenerated() As Task Dim workspace = CommonReferences="true"> @@ -207,7 +208,7 @@ End Namespace - TestCodeTypeFromFullName(workspace, "N.C", + Await TestCodeTypeFromFullName(workspace, "N.C", Sub(codeType) Assert.NotNull(codeType) Assert.Equal("N.C", codeType.FullName) @@ -225,12 +226,12 @@ End Namespace Assert.Equal("C.vb", filePath) End Sub) - End Sub + End Function #End Region - Public Sub TestDotNetNameFromLanguageSpecific() + Public Async Function TestDotNetNameFromLanguageSpecific() As Task Dim code = Imports N.M @@ -243,12 +244,12 @@ Namespace N End Namespace - TestRootCodeModelWithCodeFile(code, + Await TestRootCodeModelWithCodeFile(code, Sub(rootCodeModel) Dim dotNetName = rootCodeModel.DotNetNameFromLanguageSpecific("N.M.Generic(Of String)") Assert.Equal("N.M.Generic`1[System.String]", dotNetName) End Sub) - End Sub + End Function Protected Overrides ReadOnly Property LanguageName As String Get