' 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.Editor.Shared.Utilities Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions Imports Microsoft.CodeAnalysis.Editor.UnitTests.QuickInfo Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.Editor.VisualBasic.QuickInfo Imports Microsoft.CodeAnalysis.Shared.TestHooks Imports Microsoft.VisualStudio.Language.Intellisense Imports Microsoft.VisualStudio.Text Imports Microsoft.VisualStudio.Text.Editor Imports Microsoft.VisualStudio.Text.Projection Imports Microsoft.VisualStudio.Utilities Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.QuickInfo Public Class SemanticQuickInfoSourceTests Inherits AbstractSemanticQuickInfoSourceTests Protected Overrides Function TestAsync(markup As String, ParamArray expectedResults() As Action(Of Object)) As Task Return TestWithReferencesAsync(markup, Array.Empty(Of String)(), expectedResults) End Function Protected Async Function TestSharedAsync(workspace As TestWorkspace, position As Integer, ParamArray expectedResults() As Action(Of Object)) As Task Dim noListeners = SpecializedCollections.EmptyEnumerable(Of Lazy(Of IAsynchronousOperationListener, FeatureMetadata))() Dim provider = New SemanticQuickInfoProvider( workspace.GetService(Of IProjectionBufferFactoryService), workspace.GetService(Of IEditorOptionsFactoryService), workspace.GetService(Of ITextEditorFactoryService), workspace.GetService(Of IGlyphService), workspace.GetService(Of ClassificationTypeMap)) Await TestSharedAsync(workspace, provider, position, expectedResults) ' speculative semantic model Dim document = workspace.CurrentSolution.Projects.First().Documents.First() If Await CanUseSpeculativeSemanticModelAsync(document, position) Then Dim buffer = workspace.Documents.Single().TextBuffer Using edit = buffer.CreateEdit() edit.Replace(0, buffer.CurrentSnapshot.Length, buffer.CurrentSnapshot.GetText()) edit.Apply() End Using Await TestSharedAsync(workspace, provider, position, expectedResults) End If End Function Private Async Function TestSharedAsync(workspace As TestWorkspace, provider As SemanticQuickInfoProvider, position As Integer, expectedResults() As Action(Of Object)) As Task Dim state = Await provider.GetItemAsync(workspace.CurrentSolution.Projects.First().Documents.First(), position, cancellationToken:=CancellationToken.None) If state IsNot Nothing Then WaitForDocumentationComment(state.Content) End If If expectedResults Is Nothing Then Assert.Null(state) Else Assert.NotNull(state) For Each expected In expectedResults expected(state.Content) Next End If End Function Protected Async Function TestFromXmlAsync(markup As String, ParamArray expectedResults As Action(Of Object)()) As Task Using workspace = Await TestWorkspace.CreateAsync(markup) Await TestSharedAsync(workspace, workspace.Documents.First().CursorPosition.Value, expectedResults) End Using End Function Protected Async Function TestWithReferencesAsync(markup As String, metadataReferences As String(), ParamArray expectedResults() As Action(Of Object)) As Task Dim code As String = Nothing Dim position As Integer = Nothing MarkupTestFile.GetPosition(markup, code, position) Using workspace = Await TestWorkspace.CreateVisualBasicAsync(code, Nothing, metadataReferences:=metadataReferences) Await TestSharedAsync(workspace, position, expectedResults) End Using End Function Protected Async Function TestWithImportsAsync(markup As String, ParamArray expectedResults() As Action(Of Object)) As Task Dim markupWithImports = "Imports System" & vbCrLf & "Imports System.Collections.Generic" & vbCrLf & "Imports System.Linq" & vbCrLf & markup Await TestAsync(markupWithImports, expectedResults) End Function Protected Async Function TestInClassAsync(markup As String, ParamArray expectedResults() As Action(Of Object)) As Task Dim markupInClass = "Class C" & vbCrLf & markup & vbCrLf & "End Class" Await TestWithImportsAsync(markupInClass, expectedResults) End Function Protected Async Function TestInMethodAsync(markup As String, ParamArray expectedResults() As Action(Of Object)) As Task Dim markupInClass = "Class C" & vbCrLf & "Sub M()" & vbCrLf & markup & vbCrLf & "End Sub" & vbCrLf & "End Class" Await TestWithImportsAsync(markupInClass, expectedResults) End Function Public Async Function TestInt32() As Task Await TestInClassAsync("Dim i As $$Int32", MainDescription("Structure System.Int32")) End Function Public Async Function TestInteger() As Task Await TestInClassAsync("Dim i As $$Integer", MainDescription("Structure System.Int32", ExpectedClassifications( Keyword("Structure"), WhiteSpace(" "), Identifier("System"), Operators.Dot, Struct("Int32")))) End Function Public Async Function TestString() As Task Await TestInClassAsync("Dim i As $$String", MainDescription("Class System.String", ExpectedClassifications( Keyword("Class"), WhiteSpace(" "), Identifier("System"), Operators.Dot, [Class]("String")))) End Function Public Async Function TestStringAtEndOfToken() As Task Await TestInClassAsync("Dim i As String$$", MainDescription("Class System.String")) End Function Public Async Function TestStringLiteral() As Task Await TestInClassAsync("Dim i = ""cat""$$", MainDescription("Class System.String")) End Function Public Async Function TestInterpolatedStringLiteral() As Task Await TestInClassAsync("Dim i = $""cat""$$", MainDescription("Class System.String")) Await TestInClassAsync("Dim i = $""c$$at""", MainDescription("Class System.String")) Await TestInClassAsync("Dim i = $""$$cat""", MainDescription("Class System.String")) Await TestInClassAsync("Dim i = $""cat {1$$ + 2} dog""", MainDescription("Structure System.Int32")) End Function Public Async Function TestListOfString() As Task Await TestInClassAsync("Dim l As $$List(Of String)", MainDescription("Class System.Collections.Generic.List(Of T)", ExpectedClassifications( Keyword("Class"), WhiteSpace(" "), Identifier("System"), Operators.Dot, Identifier("Collections"), Operators.Dot, Identifier("Generic"), Operators.Dot, [Class]("List"), Punctuation.OpenParen, Keyword("Of"), WhiteSpace(" "), TypeParameter("T"), Punctuation.CloseParen)), TypeParameterMap(vbCrLf & $"T {FeaturesResources.is_} String", ExpectedClassifications( WhiteSpace(vbCrLf), TypeParameter("T"), WhiteSpace(" "), Text(FeaturesResources.is_), WhiteSpace(" "), Keyword("String")))) End Function Public Async Function TestListOfT() As Task Await TestWithImportsAsync( Class C(Of T) Dim l As $$List(Of T) End Class .NormalizedValue, MainDescription("Class System.Collections.Generic.List(Of T)", ExpectedClassifications( Keyword("Class"), WhiteSpace(" "), Identifier("System"), Operators.Dot, Identifier("Collections"), Operators.Dot, Identifier("Generic"), Operators.Dot, [Class]("List"), Punctuation.OpenParen, Keyword("Of"), WhiteSpace(" "), TypeParameter("T"), Punctuation.CloseParen))) End Function Public Async Function TestListOfT2() As Task Await TestWithImportsAsync( Class C(Of T) Dim l As Lis$$t(Of T) End Class .NormalizedValue, MainDescription("Class System.Collections.Generic.List(Of T)")) End Function Public Async Function TestListOfT3() As Task Await TestWithImportsAsync( Class C(Of T) Dim l As List$$(Of T) End Class .NormalizedValue, MainDescription("Class System.Collections.Generic.List(Of T)")) End Function Public Async Function TestListOfT4() As Task Await TestWithImportsAsync( Class C(Of T) Dim l As List $$(Of T) End Class .NormalizedValue, Nothing) End Function Public Async Function TestDictionaryOfIntegerAndString() As Task Await TestWithImportsAsync( Class C Dim d As $$Dictionary(Of Integer, String) End Class .NormalizedValue, MainDescription("Class System.Collections.Generic.Dictionary(Of TKey, TValue)"), TypeParameterMap( Lines(vbCrLf & $"TKey {FeaturesResources.is_} Integer", $"TValue {FeaturesResources.is_} String"))) End Function Public Async Function TestDictionaryOfTAndU() As Task Await TestWithImportsAsync( Class C(Of T, U) Dim d As $$Dictionary(Of T, U) End Class .NormalizedValue, MainDescription("Class System.Collections.Generic.Dictionary(Of TKey, TValue)"), TypeParameterMap( Lines(vbCrLf & $"TKey {FeaturesResources.is_} T", $"TValue {FeaturesResources.is_} U"))) End Function Public Async Function TestIEnumerableOfInteger() As Task Await TestInClassAsync("Dim ie As $$IEnumerable(Of Integer)", MainDescription("Interface System.Collections.Generic.IEnumerable(Of Out T)"), TypeParameterMap(vbCrLf & $"T {FeaturesResources.is_} Integer")) End Function Public Async Function TestEvent() As Task Await TestInMethodAsync("AddHandler System.Console.$$CancelKeyPress, AddressOf S", MainDescription("Event Console.CancelKeyPress As ConsoleCancelEventHandler", ExpectedClassifications( Keyword("Event"), WhiteSpace(" "), [Class]("Console"), Operators.Dot, Identifier("CancelKeyPress"), WhiteSpace(" "), Keyword("As"), WhiteSpace(" "), [Delegate]("ConsoleCancelEventHandler")))) End Function Public Async Function TestEventHandler() As Task Await TestInClassAsync("Dim e As $$EventHandler", MainDescription("Delegate Sub System.EventHandler(sender As Object, e As System.EventArgs)", ExpectedClassifications( Keyword("Delegate"), WhiteSpace(" "), Keyword("Sub"), WhiteSpace(" "), Identifier("System"), Operators.Dot, [Delegate]("EventHandler"), Punctuation.OpenParen, Identifier("sender"), WhiteSpace(" "), Keyword("As"), WhiteSpace(" "), Keyword("Object"), Punctuation.Comma, WhiteSpace(" "), Identifier("e"), WhiteSpace(" "), Keyword("As"), WhiteSpace(" "), Identifier("System"), Operators.Dot, [Class]("EventArgs"), Punctuation.CloseParen))) End Function Public Async Function TestTypeParameter() As Task Await TestAsync(StringFromLines("Class C(Of T)", " Dim t As $$T", "End Class"), MainDescription($"T {FeaturesResources.in_} C(Of T)")) End Function Public Async Function TestNullableOfInteger() As Task Await TestInClassAsync("Dim n As $$Nullable(Of Integer)", MainDescription("Structure System.Nullable(Of T As Structure)"), TypeParameterMap(vbCrLf & $"T {FeaturesResources.is_} Integer")) End Function Public Async Function TestGenericTypeDeclaredOnMethod1() As Task Await TestAsync( Class C Shared Sub Meth1(Of T1) Dim i As $$T1 End Sub End Class .NormalizedValue, MainDescription($"T1 {FeaturesResources.in_} C.Meth1(Of T1)")) End Function Public Async Function TestGenericTypeDeclaredOnMethod2() As Task Await TestAsync( Class C Shared Sub Meth1(Of T1 As Class) Dim i As $$T1 End Sub End Class .NormalizedValue, MainDescription($"T1 {FeaturesResources.in_} C.Meth1(Of T1 As Class)")) End Function Public Async Function TestParameter() As Task Await TestWithImportsAsync( Module C Shared Sub Foo(Of T1 As Class) Console.Wr$$ite(5) End Sub End Class .NormalizedValue, MainDescription($"Sub Console.Write(value As Integer) (+ 17 {FeaturesResources.overloads_})", ExpectedClassifications( Keyword("Sub"), WhiteSpace(" "), [Class]("Console"), Operators.Dot, Identifier("Write"), Punctuation.OpenParen, Identifier("value"), WhiteSpace(" "), Keyword("As"), WhiteSpace(" "), Keyword("Integer"), Punctuation.CloseParen, WhiteSpace(" "), Punctuation.OpenParen, Punctuation.Text("+"), WhiteSpace(" "), Text("17"), WhiteSpace(" "), Text(FeaturesResources.overloads_), Punctuation.CloseParen))) End Function Public Async Function TestOnFieldDeclaration() As Task Await TestInClassAsync("Dim $$i As Int32", MainDescription($"({FeaturesResources.field}) C.i As Integer")) End Function Public Async Function TestMinimal1() As Task Await TestAsync( Imports System.Collections.Generic Class C Dim p as New Li$$st(Of string) End Class .NormalizedValue, MainDescription($"Sub List(Of String).New() (+ 2 {FeaturesResources.overloads_})")) End Function Public Async Function TestMinimal2() As Task Await TestAsync( Imports System.Collections.Generic Class C function $$P() as List(Of string) End Class .NormalizedValue, MainDescription("Function C.P() As List(Of String)")) End Function Public Async Function TestAnd() As Task Await TestAsync( Imports System.Collections.Generic Class C sub s() dim x as Boolean x= true a$$nd False end sub End Class .NormalizedValue, MainDescription("Operator Boolean.And(left As Boolean, right As Boolean) As Boolean")) End Function Public Async Function TestDelegate() As Task Await TestAsync( Imports System Class C sub s() dim F as F$$unc(of Integer, String) end sub End Class .NormalizedValue, MainDescription("Delegate Function System.Func(Of In T, Out TResult)(arg As T) As TResult"), TypeParameterMap( Lines(vbCrLf & $"T {FeaturesResources.is_} Integer", $"TResult {FeaturesResources.is_} String"))) End Function Public Async Function TestOnDelegateInvocation() As Task Await TestAsync( Class Program delegate sub D1() shared sub Main() dim d as D1 $$d() end sub end class.NormalizedValue, MainDescription($"({FeaturesResources.local_variable}) d As D1")) End Function Public Async Function TestOnGenericOverloads1() As Task Await TestAsync( Module C Sub M() End Sub Sub M(Of T)() End Sub Sub M(Of T, U)() End Sub End Module Class Test Sub MySub() C.$$M() C.M(Of Integer)() End Sub End Class .NormalizedValue, MainDescription($"Sub C.M() (+ 2 {FeaturesResources.overloads_})")) End Function Public Async Function TestOnGenericOverloads2() As Task Await TestAsync( Module C Sub M() End Sub Sub M(Of T)() End Sub Sub M(Of T, U)() End Sub End Module Class Test Sub MySub() C.M() C.$$M(Of Integer)() End Sub End Class .NormalizedValue, MainDescription("Sub C.M(Of Integer)()")) End Function Public Async Function TestOverriddenMethod() As Task Await TestAsync( Class A Public Overridable Sub G() End Sub End Class Class B Inherits A Public Overrides Sub G() End Sub End Class Class C Sub Test() Dim x As New B x.G$$() End Sub End Class .NormalizedValue, MainDescription($"Sub B.G() (+ 1 {FeaturesResources.overload})")) End Function Public Async Function TestOnMe() As Task Await TestAsync( class C Sub Test() $$Me.Test() End Sub End class .NormalizedValue, MainDescription("Class C", ExpectedClassifications( Keyword("Class"), WhiteSpace(" "), [Class]("C")))) End Function Public Async Function TestOnArrayCreation1() As Task Await TestAsync( class C Sub Test() Dim a As Integer() = N$$ew Integer(3) { } End Sub End class .NormalizedValue, Nothing) End Function Public Async Function TestOnArrayCreation2() As Task Await TestAsync( class C Sub Test() Dim a As Integer() = New In$$teger(3) { } End Sub End class .NormalizedValue, MainDescription("Structure System.Int32")) End Function Public Async Function TestDimInFieldDeclaration() As Task Await TestInClassAsync("Dim$$ a As Integer", MainDescription("Structure System.Int32")) End Function Public Async Function TestDimMultipleInFieldDeclaration() As Task Await TestInClassAsync("$$Dim x As Integer, y As String", MainDescription(VBEditorResources.Multiple_Types)) End Function Public Async Function TestDimInFieldDeclarationCustomType() As Task Await TestAsync( Module Program Di$$m z As CustomClass Private Class CustomClass End Class End Module .NormalizedValue, MainDescription("Class Program.CustomClass")) End Function Public Async Function TestDimInLocalDeclaration() As Task Await TestInMethodAsync("Dim$$ a As Integer", MainDescription("Structure System.Int32")) End Function Public Async Function TestDimMultipleInLocalDeclaration() As Task Await TestInMethodAsync("$$Dim x As Integer, y As String", MainDescription(VBEditorResources.Multiple_Types)) End Function Public Async Function TestDimInLocalDeclarationCustomType() As Task Await TestAsync( Module Program Sub Main(args As String()) D$$im z As CustomClass End Sub Private Class CustomClass End Class End Module .NormalizedValue, MainDescription("Class Program.CustomClass")) End Function Public Async Function TestDefaultProperty1() As Task Await TestAsync( Class X Public ReadOnly Property Foo As Y Get Return Nothing End Get End Property End Class Class Y Public Default ReadOnly Property Item(ByVal a As Integer) As String Get Return "hi" End Get End Property End Class Module M1 Sub Main() Dim a As String Dim b As X b = New X() a = b.F$$oo(4) End Sub End Module .NormalizedValue, MainDescription("ReadOnly Property X.Foo As Y")) End Function Public Async Function TestDefaultProperty2() As Task Await TestAsync( Class X Public ReadOnly Property Foo As Y Get Return Nothing End Get End Property End Class Class Y Public Default ReadOnly Property Item(ByVal a As Integer) As String Get Return "hi" End Get End Property End Class Module M1 Sub Main() Dim a As String Dim b As X b = New X() a = b.Foo.I$$tem(4) End Sub End Module .NormalizedValue, MainDescription("ReadOnly Property Y.Item(a As Integer) As String")) End Function Public Async Function TestLambdaExpression() As Task Await TestAsync(Imports System Imports System.Collections.Generic Imports System.Linq Module Module1 Sub Main(ByVal args As String()) Dim increment2 As Func(Of Integer, UInt16) = Function(x42)$$ Return x42 + 2 End Function End Sub End Module.NormalizedValue, Nothing) End Function Public Async Function TestUnboundMethodInvocation() As Task Await TestInMethodAsync("Me.Fo$$o()", Nothing) End Function Public Async Function TestQuickInfoOnExtensionMethod() As Task Await TestAsync( _ Public Function Count(Of T)(o As T, items As IEnumerable(Of T)) As Boolean Return True End Function End Module]]>.NormalizedValue, MainDescription($"<{VBFeaturesResources.Extension}> Function Integer.Count(items As IEnumerable(Of Integer)) As Boolean")) End Function Public Async Function TestQuickInfoOnExtensionMethodOverloads() As Task Await TestAsync( Public Sub TestExt(Of T)(ex As T) End Sub Public Sub TestExt(Of T)(ex As T, arg As T) End Sub Public Sub TestExt(ex As String, arg As Integer) End Sub End Module]]>.NormalizedValue, MainDescription($"<{VBFeaturesResources.Extension}> Sub String.TestExt() (+ 2 {FeaturesResources.overloads_})")) End Function Public Async Function TestQuickInfoOnExtensionMethodOverloads2() As Task Await TestAsync( Public Sub TestExt(Of T)(ex As T) End Sub Public Sub TestExt(Of T)(ex As T, arg As T) End Sub Public Sub TestExt(ex As Integer, arg As Integer) End Sub End Module]]>.NormalizedValue, MainDescription($"<{VBFeaturesResources.Extension}> Sub String.TestExt() (+ 1 {FeaturesResources.overload})")) End Function Public Async Function TestDontRemoveAttributeSuffixAndProduceInvalidIdentifier1() As Task Await TestAsync(.NormalizedValue, MainDescription($"({FeaturesResources.field}) _Attribute.x As _Attribute")) End Function Public Async Function TestDontRemoveAttributeSuffixAndProduceInvalidIdentifier2() As Task Await TestAsync(.NormalizedValue, MainDescription($"({FeaturesResources.field}) ClassAttribute.x As ClassAttribute")) End Function Public Async Function TestDontRemoveAttributeSuffix1() As Task Await TestAsync(.NormalizedValue, MainDescription($"({FeaturesResources.field}) Class1Attribute.x As Class1Attribute")) End Function Public Async Function TestAttributeQuickInfoBindsToClassTest() As Task Await TestAsync(" Imports System ''' ''' class comment ''' Class SomeAttribute Inherits Attribute ''' ''' ctor comment ''' Public Sub New() End Sub End Class ", Documentation("class comment")) End Function Public Async Function TestAttributeConstructorQuickInfo() As Task Await TestAsync(" Imports System ''' ''' class comment ''' Class SomeAttribute Inherits Attribute ''' ''' ctor comment ''' Public Sub New() Dim s = New Some$$Attribute() End Sub End Class ", Documentation("ctor comment")) End Function Public Async Function TestUnboundGeneric() As Task Await TestAsync(.NormalizedValue, MainDescription("Class System.Collections.Generic.List(Of T)"), NoTypeParameterMap) End Function Public Async Function TestQuickInfoForAnonymousType1() As Task Await TestAsync(.NormalizedValue, MainDescription("AnonymousType 'a"), NoTypeParameterMap, AnonymousTypes(vbCrLf & FeaturesResources.Anonymous_Types_colon & vbCrLf & $" 'a {FeaturesResources.is_} New With {{ Key .Name As String, Key .Price As Integer }}")) End Function Public Async Function TestQuickInfoForAnonymousType2() As Task Await TestAsync(.NormalizedValue, MainDescription("ReadOnly Property 'a.Name As String"), NoTypeParameterMap, AnonymousTypes(vbCrLf & FeaturesResources.Anonymous_Types_colon & vbCrLf & $" 'a {FeaturesResources.is_} New With {{ Key .Name As String, Key .Price As Integer }}")) End Function Public Async Function TestQuickInfoForAnonymousType3() As Task Await TestAsync(.NormalizedValue, MainDescription("AnonymousType 'a"), NoTypeParameterMap, AnonymousTypes(vbCrLf & FeaturesResources.Anonymous_Types_colon & vbCrLf & $" 'a {FeaturesResources.is_} New With {{ Key .Foo As ? }}")) End Function Public Async Function TestQuickInfoForUnboundLabel() As Task Await TestAsync(.NormalizedValue, Nothing) End Function Public Async Function TestQuickInfoForAnonymousDelegate1() As Task Await TestAsync(.NormalizedValue, MainDescription($"({FeaturesResources.local_variable}) a As ")) End Function Public Async Function TestQuickInfoForAnonymousDelegate2() As Task Await TestAsync(.NormalizedValue, MainDescription($"({FeaturesResources.local_variable}) a As ")) End Function Public Async Function TestQuickInfoForAnonymousDelegate3() As Task Await TestAsync(.NormalizedValue, MainDescription($"({FeaturesResources.local_variable}) a As "), AnonymousTypes(vbCrLf & FeaturesResources.Anonymous_Types_colon & vbCrLf & $" 'a {FeaturesResources.is_} New With {{ .Foo As String }}")) End Function Public Async Function TestQuickInfoForAnonymousDelegate4() As Task Await TestAsync(.NormalizedValue, MainDescription($"({FeaturesResources.local_variable}) a As "), AnonymousTypes(vbCrLf & FeaturesResources.Anonymous_Types_colon & vbCrLf & $" 'a {FeaturesResources.is_} New With {{ .Sq As Integer, .M As }}")) End Function Public Async Function TestImplicitMemberNameLocal1() As Task Await TestAsync(.NormalizedValue, MainDescription("ReadOnly Property Program.Prop As Long")) End Function Public Async Function TestImplicitMemberNameLocal2() As Task Await TestAsync(.NormalizedValue, MainDescription("ReadOnly Property Program.Prop As Long")) End Function Public Async Function TestImplicitMemberNameLocal3() As Task Await TestAsync(.NormalizedValue, MainDescription("Function Program.Foo() As Integer")) End Function Public Async Function TestBinaryConditionalExpression() As Task Await TestInMethodAsync("Dim x = If$$(True, False)", MainDescription($"If({VBWorkspaceResources.expression}, {VBWorkspaceResources.expressionIfNothing}) As Boolean"), Documentation(VBWorkspaceResources.If_expression_evaluates_to_a_reference_or_Nullable_value_that_is_not_Nothing_the_function_returns_that_value_Otherwise_it_calculates_and_returns_expressionIfNothing)) End Function Public Async Function TestTernaryConditionalExpression() As Task Await TestInMethodAsync("Dim x = If$$(True, ""Foo"", ""Bar"")", MainDescription($"If({VBWorkspaceResources.condition} As Boolean, {VBWorkspaceResources.expressionIfTrue}, {VBWorkspaceResources.expressionIfFalse}) As String"), Documentation(VBWorkspaceResources.If_condition_returns_True_the_function_calculates_and_returns_expressionIfTrue_Otherwise_it_returns_expressionIfFalse)) End Function Public Async Function TestAddHandlerStatement() As Task Await TestInMethodAsync("$$AddHandler foo, bar", MainDescription($"AddHandler {VBWorkspaceResources.event_}, {VBWorkspaceResources.handler}"), Documentation(VBWorkspaceResources.Associates_an_event_with_an_event_handler_delegate_or_lambda_expression_at_run_time), SymbolGlyph(Glyph.Keyword)) End Function Public Async Function TestRemoveHandlerStatement() As Task Await TestInMethodAsync("$$RemoveHandler foo, bar", MainDescription($"RemoveHandler {VBWorkspaceResources.event_}, {VBWorkspaceResources.handler}"), Documentation(VBWorkspaceResources.Removes_the_association_between_an_event_and_an_event_handler_or_delegate_at_run_time), SymbolGlyph(Glyph.Keyword)) End Function Public Async Function TestGetTypeExpression() As Task Await TestInMethodAsync("Dim x = GetType$$(String)", MainDescription("GetType(String) As Type"), Documentation(VBWorkspaceResources.Returns_a_System_Type_object_for_the_specified_type_name)) End Function Public Async Function TestGetXmlNamespaceExpression() As Task Await TestWithReferencesAsync( class C sub M() Dim x = GetXmlNamespace$$() end sub() end class .NormalizedValue, {GetType(System.Xml.XmlAttribute).Assembly.Location, GetType(System.Xml.Linq.XAttribute).Assembly.Location}, MainDescription($"GetXmlNamespace([{VBWorkspaceResources.xmlNamespacePrefix}]) As Xml.Linq.XNamespace"), Documentation(VBWorkspaceResources.Returns_the_System_Xml_Linq_XNamespace_object_corresponding_to_the_specified_XML_namespace_prefix)) End Function Public Async Function TestTryCastExpression() As Task Await TestInMethodAsync("Dim x = TryCast$$(a, String)", MainDescription($"TryCast({VBWorkspaceResources.expression}, String) As String"), Documentation(VBWorkspaceResources.Introduces_a_type_conversion_operation_that_does_not_throw_an_exception_If_an_attempted_conversion_fails_TryCast_returns_Nothing_which_your_program_can_test_for)) End Function Public Async Function TestDirectCastExpression() As Task Await TestInMethodAsync("Dim x = DirectCast$$(a, String)", MainDescription($"DirectCast({VBWorkspaceResources.expression}, String) As String"), Documentation(VBWorkspaceResources.Introduces_a_type_conversion_operation_similar_to_CType_The_difference_is_that_CType_succeeds_as_long_as_there_is_a_valid_conversion_whereas_DirectCast_requires_that_one_type_inherit_from_or_implement_the_other_type)) End Function Public Async Function TestCTypeCastExpression() As Task Await TestInMethodAsync("Dim x = CType$$(a, String)", MainDescription($"CType({VBWorkspaceResources.expression}, String) As String"), Documentation(VBWorkspaceResources.Returns_the_result_of_explicitly_converting_an_expression_to_a_specified_data_type)) End Function Public Async Function TestCBoolExpression() As Task Await TestInMethodAsync("Dim x = CBool$$(a)", MainDescription($"CBool({VBWorkspaceResources.expression}) As Boolean"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "Boolean"))) End Function Public Async Function TestCByteExpression() As Task Await TestInMethodAsync("Dim x = CByte$$(a)", MainDescription($"CByte({VBWorkspaceResources.expression}) As Byte"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "Byte"))) End Function Public Async Function TestCCharExpression() As Task Await TestInMethodAsync("Dim x = CChar$$(a)", MainDescription($"CChar({VBWorkspaceResources.expression}) As Char"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "Char"))) End Function Public Async Function TestCDateExpression() As Task Await TestInMethodAsync("Dim x = CDate$$(a)", MainDescription($"CDate({VBWorkspaceResources.expression}) As Date"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "Date"))) End Function Public Async Function TestCDblExpression() As Task Await TestInMethodAsync("Dim x = CDbl$$(a)", MainDescription($"CDbl({VBWorkspaceResources.expression}) As Double"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "Double"))) End Function Public Async Function TestCDecExpression() As Task Await TestInMethodAsync("Dim x = CDec$$(a)", MainDescription($"CDec({VBWorkspaceResources.expression}) As Decimal"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "Decimal"))) End Function Public Async Function TestCIntExpression() As Task Await TestInMethodAsync("Dim x = CInt$$(a)", MainDescription($"CInt({VBWorkspaceResources.expression}) As Integer"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "Integer"))) End Function Public Async Function TestCLngExpression() As Task Await TestInMethodAsync("Dim x = CLng$$(a)", MainDescription($"CLng({VBWorkspaceResources.expression}) As Long"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "Long"))) End Function Public Async Function TestCObjExpression() As Task Await TestInMethodAsync("Dim x = CObj$$(a)", MainDescription($"CObj({VBWorkspaceResources.expression}) As Object"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "Object"))) End Function Public Async Function TestCSByteExpression() As Task Await TestInMethodAsync("Dim x = CSByte$$(a)", MainDescription($"CSByte({VBWorkspaceResources.expression}) As SByte"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "SByte"))) End Function Public Async Function TestCShortExpression() As Task Await TestInMethodAsync("Dim x = CShort$$(a)", MainDescription($"CShort({VBWorkspaceResources.expression}) As Short"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "Short"))) End Function Public Async Function TestCSngExpression() As Task Await TestInMethodAsync("Dim x = CSng$$(a)", MainDescription($"CSng({VBWorkspaceResources.expression}) As Single"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "Single"))) End Function Public Async Function TestCStrExpression() As Task Await TestInMethodAsync("Dim x = CStr$$(a)", MainDescription($"CStr({VBWorkspaceResources.expression}) As String"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "String"))) End Function Public Async Function TestCUIntExpression() As Task Await TestInMethodAsync("Dim x = CUInt$$(a)", MainDescription($"CUInt({VBWorkspaceResources.expression}) As UInteger"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "UInteger"))) End Function Public Async Function TestCULngExpression() As Task Await TestInMethodAsync("Dim x = CULng$$(a)", MainDescription($"CULng({VBWorkspaceResources.expression}) As ULong"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "ULong"))) End Function Public Async Function TestCUShortExpression() As Task Await TestInMethodAsync("Dim x = CUShort$$(a)", MainDescription($"CUShort({VBWorkspaceResources.expression}) As UShort"), Documentation(String.Format(VBWorkspaceResources.Converts_an_expression_to_the_0_data_type, "UShort"))) End Function Public Async Function TestMidAssignmentStatement1() As Task Await TestInMethodAsync("$$Mid(""foo"", 0) = ""bar""", MainDescription($"Mid({VBWorkspaceResources.stringName}, {VBWorkspaceResources.startIndex}, [{VBWorkspaceResources.length}]) = {VBWorkspaceResources.stringExpression}"), Documentation(VBWorkspaceResources.Replaces_a_specified_number_of_characters_in_a_String_variable_with_characters_from_another_string)) End Function Public Async Function TestMidAssignmentStatement2() As Task Await TestInMethodAsync("$$Mid(""foo"", 0, 0) = ""bar""", MainDescription($"Mid({VBWorkspaceResources.stringName}, {VBWorkspaceResources.startIndex}, [{VBWorkspaceResources.length}]) = {VBWorkspaceResources.stringExpression}"), Documentation(VBWorkspaceResources.Replaces_a_specified_number_of_characters_in_a_String_variable_with_characters_from_another_string)) End Function Public Async Function TestConstantField() As Task Await TestInClassAsync("const $$F = 1", MainDescription($"({FeaturesResources.constant}) C.F As Integer = 1")) End Function Public Async Function TestMultipleConstantFields() As Task Await TestInClassAsync("Public Const X As Double = 1.0, Y As Double = 2.0, $$Z As Double = 3.5", MainDescription($"({FeaturesResources.constant}) C.Z As Double = 3.5")) End Function Public Async Function TestConstantDependencies() As Task Await TestAsync(.NormalizedValue, MainDescription($"({FeaturesResources.constant}) A.X As Integer = B.Z + 1")) End Function Public Async Function TestConstantCircularDependencies() As Task Await TestAsync(.NormalizedValue, MainDescription($"({FeaturesResources.constant}) A.X As Integer = B.Z + 1")) End Function Public Async Function TestConstantOverflow() As Task Await TestInClassAsync("Public Const $$Z As Integer = Integer.MaxValue + 1", MainDescription($"({FeaturesResources.constant}) C.Z As Integer = Integer.MaxValue + 1")) End Function Public Async Function TestEnumInConstantField() As Task Await TestAsync(.NormalizedValue, MainDescription($"({FeaturesResources.local_constant}) x As Integer = CInt(Days.Sun)")) End Function Public Async Function TestEnumInConstantField2() As Task Await TestAsync(.NormalizedValue, MainDescription($"({FeaturesResources.local_constant}) x As Days = Days.Sun")) End Function Public Async Function TestConstantParameter() As Task Await TestInClassAsync("Sub Bar(optional $$b as Integer = 1)", MainDescription($"({FeaturesResources.parameter}) b As Integer = 1")) End Function Public Async Function TestConstantLocal() As Task Await TestInMethodAsync("const $$loc = 1", MainDescription($"({FeaturesResources.local_constant}) loc As Integer = 1")) End Function Public Async Function TestEnumValue1() As Task Await TestInMethodAsync("Const $$sunday = DayOfWeek.Sunday", MainDescription($"({FeaturesResources.local_constant}) sunday As DayOfWeek = DayOfWeek.Sunday")) End Function Public Async Function TestEnumValue2() As Task Await TestInMethodAsync("Const $$v = AttributeTargets.Constructor or AttributeTargets.Class", MainDescription($"({FeaturesResources.local_constant}) v As AttributeTargets = AttributeTargets.Constructor or AttributeTargets.Class")) End Function Public Async Function TestComplexConstantParameter() As Task Await TestInClassAsync("Sub Bar(optional $$b as Integer = 1 + True)", MainDescription($"({FeaturesResources.parameter}) b As Integer = 1 + True")) End Function Public Async Function TestIndexedPropertyWithOptionalParameter() As Task Await TestAsync(.NormalizedValue, MainDescription("Property Test.Prop(p1 As Integer, [p2 As Integer = 0]) As Integer")) End Function Public Async Function TestAwaitableMethod() As Task Dim markup = Imports System.Threading.Tasks Class C Async Function foo() As Task fo$$o() End Function End Class .ToString() Dim description = <<%= VBFeaturesResources.Awaitable %>> Function C.foo() As Task.ConvertTestSourceTag() Dim doc = StringFromLines("", WorkspacesResources.Usage_colon, $" {SyntaxFacts.GetText(SyntaxKind.AwaitKeyword)} foo()") Await TestFromXmlAsync(markup, MainDescription(description), Usage(doc)) End Function Public Async Function TestObjectWithOptionStrictOffIsntAwaitable() As Task Dim markup = " Option Strict Off Class C Function D() As Object Return Nothing End Function Sub M() D$$() End Sub End Class " Await TestAsync(markup, MainDescription("Function C.D() As Object")) End Function Public Async Function TestObsoleteItem() As Task Await TestAsync( Sub Foo() Fo$$o() End Sub End Class ]]>.NormalizedValue, MainDescription($"({VBFeaturesResources.Deprecated}) Sub C.Foo()")) End Function Public Async Function TestEnumMemberNameFromMetadata() As Task Dim code = Imports System Class C Sub M() Dim c = ConsoleColor.Bla$$ck End Sub End Class .NormalizedValue() Await TestAsync(code, MainDescription("ConsoleColor.Black = 0")) End Function Public Async Function TestEnumMemberNameFromSource1() As Task Dim code = Enum Foo A = 1 << 0 B = 1 << 1 C = 1 << 2 End Enum Class C Sub M() Dim e = Foo.B$$ End Sub End Class .NormalizedValue() Await TestAsync(code, MainDescription("Foo.B = 1 << 1")) End Function Public Async Function TestEnumMemberNameFromSource2() As Task Dim code = Enum Foo A B C End Enum Class C Sub M() Dim e = Foo.B$$ End Sub End Class .NormalizedValue() Await TestAsync(code, MainDescription("Foo.B = 1")) End Function Public Async Function TestTextOnlyDocComment() As Task Await TestAsync( '''foo ''' Class C$$ End Class]]>.NormalizedValue(), Documentation("foo")) End Function Public Async Function TestTrimConcatMultiLine() As Task Await TestAsync( ''' foo ''' bar ''' Class C$$ End Class]]>.NormalizedValue(), Documentation("foo bar")) End Function Public Async Function TestCref() As Task Await TestAsync( ''' ''' ''' Class C$$ End Class]]>.NormalizedValue(), Documentation("C C")) End Function Public Async Function TestExcludeTextOutsideSummaryBlock() As Task Await TestAsync( ''' green ''' ''' yellow Class C$$ End Class]]>.NormalizedValue(), Documentation("green")) End Function Public Async Function TestNewlineAfterPara() As Task Await TestAsync( ''' foo ''' Class C$$ End Class]]>.NormalizedValue(), Documentation("foo")) End Function Public Async Function TestParam() As Task Await TestAsync( Public Class C ''' A type parameter of ''' First parameter of ''' Another parameter of Public Function Foo(Of T)(arg$$s As String(), otherParam As T) End Function End Class]]>.NormalizedValue(), Documentation("First parameter of C.Foo(Of T)(String(), T)")) End Function Public Async Function TestParam2() As Task Await TestAsync( Public Class C ''' A type parameter of ''' First parameter of ''' Another parameter of Public Function Foo(Of T)(args As String(), otherP$$aram As T) End Function End Class]]>.NormalizedValue(), Documentation("Another parameter of C.Foo(Of T)(String(), T)")) End Function Public Async Function TestTypeParam() As Task Await TestAsync( Public Class C ''' A type parameter of ''' First parameter of ''' Another parameter of Public Function Foo(Of T$$)( args as String(), otherParam as T) End Function End Class]]>.NormalizedValue(), Documentation("A type parameter of C.Foo(Of T)(String(), T)")) End Function Public Async Function TestUnboundCref() As Task Await TestAsync( Public Class C ''' A type parameter of Public Function Foo(Of T$$)( args as String(), otherParam as T) End Function End Class]]>.NormalizedValue(), Documentation("A type parameter of foo(Of T) (string, T)")) End Function Public Async Function TestCrefInConstructor() As Task Await TestAsync( ''' This sample shows how to specify the constructor as a cref attribute. ''' Public Sub N$$ew() End Sub End Class]]>.NormalizedValue(), Documentation("This sample shows how to specify the TestClass constructor as a cref attribute.")) End Function Public Async Function TestCrefInConstructorOverloaded() As Task Await TestAsync( ''' This sample shows how to specify the constructor as a cref attribute. ''' Public Sub Ne$$w(value As Integer) End Sub End Class]]>.NormalizedValue(), Documentation("This sample shows how to specify the New(Integer) constructor as a cref attribute.")) End Function Public Async Function TestCrefInGenericMethod1() As Task Await TestAsync( ''' This sample shows how to specify the method as a cref attribute. ''' Public Shared Function GetGe$$nericValue(Of T)(para As T) As T Return para End Function End Class]]>.NormalizedValue(), Documentation("This sample shows how to specify the TestClass.GetGenericValue(Of T)(T) method as a cref attribute.")) End Function Public Async Function TestCrefInGenericMethod2() As Task Await TestAsync( ''' This sample shows how to specify the method as a cref attribute. ''' Public Shared Function GetGe$$nericValue(Of T)(para As T) As T Return para End Function End Class]]>.NormalizedValue(), Documentation("This sample shows how to specify the GetGenericValue(OfT)(T) method as a cref attribute.")) End Function Public Async Function TestCrefInMethodOverloading1() As Task Await TestAsync( ''' This sample shows how to specify the method as a cref attribute. ''' Public Shared Function GetGenericValue(Of T)(para As T) As T Return para End Function ''' ''' This sample shows how to specify the method as a cref attribute. ''' Public Shared Sub GetGenericValue() End Sub End Class]]>.NormalizedValue(), Documentation("This sample shows how to specify the TestClass.GetGenericValue() method as a cref attribute.")) End Function Public Async Function TestCrefInMethodOverloading2() As Task Await TestAsync( ''' This sample shows how to specify the method as a cref attribute. ''' Public Shared Function GetGenericValue(Of T)(para As T) As T Return para End Function ''' ''' This sample shows how to specify the method as a cref attribute. ''' Public Shared Sub GetGenericValue() End Sub End Class]]>.NormalizedValue(), Documentation("This sample shows how to specify the GetGenericValue(OfT)(T) method as a cref attribute.")) End Function Public Async Function TestCrefInGenericType() As Task Await TestAsync( ''' This sample shows how to specify the cref. ''' Public Class Generic$$Class(Of T) End Class]]>.NormalizedValue(), Documentation("This sample shows how to specify the GenericClass(Of T) cref.", ExpectedClassifications( Text("This sample shows how to specify the"), WhiteSpace(" "), [Class]("GenericClass"), Punctuation.OpenParen, Keyword("Of"), WhiteSpace(" "), TypeParameter("T"), Punctuation.CloseParen, WhiteSpace(" "), Text("cref.")))) End Function ''' ''' As a part of fix for 756226, quick info for VB Await keyword now displays the type inferred from the AwaitExpression. This is C# behavior. ''' In Dev12, quick info for VB Await keyword was the syntactic help "Await <expression>". ''' In Roslyn, VB Syntactic quick info is Not yet Implemented. User story: 522342. ''' While implementing this story, determine the correct behavior for quick info on VB Await keyword (syntactic vs semantic) and update these tests. ''' Public Async Function TestAwaitKeywordOnTaskReturningAsync() As Task Dim markup = Imports System.Threading.Tasks Class C Async Function foo() As Task Aw$$ait foo() End Function End Class .ToString() Dim description = <%= FeaturesResources.Awaited_task_returns %><%= " " %><%= FeaturesResources.no_value %>.ConvertTestSourceTag() Await TestFromXmlAsync(markup, MainDescription(description)) End Function Public Async Function TestAwaitKeywordOnGenericTaskReturningAsync() As Task Dim markup = Imports System.Threading.Tasks Class C Async Function foo() As Task(Of Integer) Dim x = Aw$$ait foo() Return 42 End Function End Class .ToString() Dim description = <%= FeaturesResources.Awaited_task_returns %> Structure System.Int32.ConvertTestSourceTag() Await TestFromXmlAsync(markup, MainDescription(description)) End Function Public Async Function TestAwaitKeywordOnTaskReturningAsync2() As Task Dim markup = Imports System.Threading.Tasks Class C Async Sub Foo() Aw$$ait Task.Delay(10) End Sub End Class .ToString() Dim description = <%= FeaturesResources.Awaited_task_returns %><%= " " %><%= FeaturesResources.no_value %>.ConvertTestSourceTag() Await TestFromXmlAsync(markup, MainDescription(description)) End Function Public Async Function TestNestedAwaitKeywords1() As Task Dim markup = Imports System Imports System.Threading.Tasks Class AsyncExample Async Function AsyncMethod() As Task(Of Task(Of Integer)) Return NewMethod() End Function Private Shared Function NewMethod() As Task(Of Integer) Throw New NotImplementedException() End Function Async Function UseAsync() As Task Dim lambda As Func(Of Task(Of Integer)) = Async Function() Return Await Await AsyncMethod() End Function Dim result = Await Await AsyncMethod() Dim resultTask As Task(Of Task(Of Integer)) = AsyncMethod() result = Await Awai$$t resultTask result = Await lambda() End Function End Class .ToString() Dim description = <<%= VBFeaturesResources.Awaitable %>> <%= FeaturesResources.Awaited_task_returns %> Class System.Threading.Tasks.Task(Of TResult).ConvertTestSourceTag() Await TestFromXmlAsync(markup, MainDescription(description), TypeParameterMap(vbCrLf & $"TResult {FeaturesResources.is_} Integer")) End Function Public Async Function TestNestedAwaitKeywords2() As Task Dim markup = Imports System Imports System.Threading.Tasks Class AsyncExample Async Function AsyncMethod() As Task(Of Task(Of Integer)) Return NewMethod() End Function Private Shared Function NewMethod() As Task(Of Integer) Throw New NotImplementedException() End Function Async Function UseAsync() As Task Dim lambda As Func(Of Task(Of Integer)) = Async Function() Return Await Await AsyncMethod() End Function Dim result = Await Await AsyncMethod() Dim resultTask As Task(Of Task(Of Integer)) = AsyncMethod() result = Awai$$t Await resultTask result = Await lambda() End Function End Class .ToString() Dim description = <%= FeaturesResources.Awaited_task_returns %> Structure System.Int32.ConvertTestSourceTag() Await TestFromXmlAsync(markup, MainDescription(description)) End Function Public Async Function TestTaskType() As Task Dim markup = Imports System Imports System.Threading.Tasks Class AsyncExample Sub Foo() Dim v as Tas$$k = Nothing End Sub End Class .ToString() Dim description = <<%= VBFeaturesResources.Awaitable %>> Class System.Threading.Tasks.Task.ConvertTestSourceTag() Await TestFromXmlAsync(markup, MainDescription(description)) End Function Public Async Function TestTaskOfTType() As Task Dim markup = Imports System Imports System.Threading.Tasks Class AsyncExample Sub Foo() Dim v as Tas$$k(Of Integer) = Nothing End Sub End Class .ToString() Dim description = <<%= VBFeaturesResources.Awaitable %>> Class System.Threading.Tasks.Task(Of TResult).ConvertTestSourceTag() Await TestFromXmlAsync(markup, MainDescription(description), TypeParameterMap(vbCrLf & $"TResult {FeaturesResources.is_} Integer")) End Function Public Async Function TestAwaitablePrefixOnCustomAwaiter() As Task Dim markup = Imports System Imports System.Collections.Generic Imports System.Linq Imports System.Runtime.CompilerServices Module Program Sub Main(args As String()) Dim x As C$$ End Sub End Module Class C Public Function GetAwaiter() As MyAwaiter End Function End Class Public Class MyAwaiter Implements INotifyCompletion Public Property IsCompleted As Boolean Public Sub GetResult() End Sub Public Sub OnCompleted(continuation As Action) Implements INotifyCompletion.OnCompleted Throw New NotImplementedException() End Sub End Class .ToString() Dim description = <<%= VBFeaturesResources.Awaitable %>> Class C.ConvertTestSourceTag() Await TestFromXmlAsync(markup, MainDescription(description)) End Function Public Async Function TestGenericMethodWithConstraintsAtDeclaration() As Task Await TestInClassAsync("Private Function Fo$$o(Of TIn As Class, TOut)(arg As TIn) As TOut Foo(Of TIn, TOut)(Nothing) End Function", MainDescription("Function C.Foo(Of TIn As Class, TOut)(arg As TIn) As TOut")) End Function Public Async Function TestGenericMethodWithMultipleConstraintsAtDeclaration() As Task Await TestInClassAsync("Private Function Fo$$o(Of TIn As {IComparable, New}, TOut)(arg As TIn) As TOut Foo(Of TIn, TOut)(Nothing) End Function", MainDescription("Function C.Foo(Of TIn As {IComparable, New}, TOut)(arg As TIn) As TOut")) End Function Public Async Function TestUnConstructedGenericMethodWithConstraintsAtInvocation() As Task Await TestInClassAsync("Private Function Foo(Of TIn As {Class, New}, TOut)(arg As TIn) As TOut F$$oo(Of TIn, TOut)(Nothing) End Function", MainDescription("Function C.Foo(Of TIn As {Class, New}, TOut)(arg As TIn) As TOut")) End Function Public Async Function TestDocumentationInImportsDirectiveWithAlias() As Task Dim markup = Imports I = IFoo Class C Implements I$$ Public Sub Bar() Implements IFoo.Bar Throw New NotImplementedException() End Sub End Class ''' <summary> ''' summary for interface IFoo ''' </summary> Interface IFoo Sub Bar() End Interface .ToString() Await TestFromXmlAsync(markup, MainDescription("Interface IFoo"), Documentation("summary for interface IFoo")) End Function Public Async Function TestQuickInfoExceptions() As Task Await TestAsync(" Imports System Namespace MyNs Class MyException1 Inherits Exception End Class Class MyException2 Inherits Exception End Class Class TestClass ''' ''' ''' ''' ''' Sub M() M$$() End Sub End Class End Namespace ", Exceptions($"{vbCrLf}{WorkspacesResources.Exceptions_colon}{vbCrLf} MyException1{vbCrLf} MyException2{vbCrLf} Integer{vbCrLf} Double{vbCrLf} Not_A_Class_But_Still_Displayed")) End Function Public Async Function TestQuickInfoWithNonStandardSeeAttributesAppear() As Task Await TestAsync(" Class C ''' ''' ''' ''' ''' ''' Sub M() M$$() End Sub End Class ", Documentation("String http://microsoft.com Nothing cat")) End Function End Class End Namespace