AbstractCodeDelegateTests.vb 4.0 KB
Newer Older
1 2 3 4 5 6 7 8 9
' Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel
    Public MustInherit Class AbstractCodeDelegateTests
        Inherits AbstractCodeElementTests(Of EnvDTE80.CodeDelegate2)

        Protected Overrides Function GetAccess(codeElement As EnvDTE80.CodeDelegate2) As EnvDTE.vsCMAccess
            Return codeElement.Access
        End Function
D
Dustin Campbell 已提交
10 11 12 13

        Protected Overrides Function GetAttributes(codeElement As EnvDTE80.CodeDelegate2) As EnvDTE.CodeElements
            Return codeElement.Attributes
        End Function
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66

        Protected Overrides Function GetComment(codeElement As EnvDTE80.CodeDelegate2) As String
            Return codeElement.Comment
        End Function

        Protected Overrides Function GetDocComment(codeElement As EnvDTE80.CodeDelegate2) As String
            Return codeElement.DocComment
        End Function

        Protected Overrides Function GetEndPointFunc(codeElement As EnvDTE80.CodeDelegate2) As Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint)
            Return Function(part) codeElement.GetEndPoint(part)
        End Function

        Protected Overrides Function GetFullName(codeElement As EnvDTE80.CodeDelegate2) As String
            Return codeElement.FullName
        End Function

        Protected Overrides Function GetKind(codeElement As EnvDTE80.CodeDelegate2) As EnvDTE.vsCMElement
            Return codeElement.Kind
        End Function

        Protected Overrides Function GetName(codeElement As EnvDTE80.CodeDelegate2) As String
            Return codeElement.Name
        End Function

        Protected Overrides Function GetNameSetter(codeElement As EnvDTE80.CodeDelegate2) As Action(Of String)
            Return Sub(name) codeElement.Name = name
        End Function

        Protected Overrides Function GetParent(codeElement As EnvDTE80.CodeDelegate2) As Object
            Return codeElement.Parent
        End Function

        Protected Overrides Function GetPrototype(codeElement As EnvDTE80.CodeDelegate2, flags As EnvDTE.vsCMPrototype) As String
            Return codeElement.Prototype(flags)
        End Function

        Protected Overrides Function GetStartPointFunc(codeElement As EnvDTE80.CodeDelegate2) As Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint)
            Return Function(part) codeElement.GetStartPoint(part)
        End Function

        Protected Overrides Function GetTypeProp(codeElement As EnvDTE80.CodeDelegate2) As EnvDTE.CodeTypeRef
            Return codeElement.Type
        End Function

        Protected Overrides Function GetTypePropSetter(codeElement As EnvDTE80.CodeDelegate2) As Action(Of EnvDTE.CodeTypeRef)
            Return Sub(value) codeElement.Type = value
        End Function

        Protected Overrides Function AddParameter(codeElement As EnvDTE80.CodeDelegate2, data As ParameterData) As EnvDTE.CodeParameter
            Return codeElement.AddParameter(data.Name, data.Type, data.Position)
        End Function

67 68 69 70
        Protected Overrides Function GetParameters(codeElement As EnvDTE80.CodeDelegate2) As EnvDTE.CodeElements
            Return codeElement.Parameters
        End Function

71 72 73 74
        Protected Overrides Function AddAttribute(codeElement As EnvDTE80.CodeDelegate2, data As AttributeData) As EnvDTE.CodeAttribute
            Return codeElement.AddAttribute(data.Name, data.Value, data.Position)
        End Function

75 76 77 78
        Protected Overrides Sub RemoveChild(codeElement As EnvDTE80.CodeDelegate2, child As Object)
            codeElement.RemoveParameter(child)
        End Sub

C
Cyrus Najmabadi 已提交
79 80
        Protected Async Function TestBaseClass(code As XElement, expectedFullName As String) As Threading.Tasks.Task
            Await TestElement(code,
81 82 83 84
                Sub(codeElement)
                    Assert.NotNull(codeElement.BaseClass)
                    Assert.Equal(expectedFullName, codeElement.BaseClass.FullName)
                End Sub)
C
Cyrus Najmabadi 已提交
85
        End Function
86 87 88

    End Class
End Namespace