|
| 1 | +' Licensed to the .NET Foundation under one or more agreements. |
| 2 | +' The .NET Foundation licenses this file to you under the MIT license. |
| 3 | +' See the LICENSE file in the project root for more information. |
| 4 | + |
| 5 | +Imports Microsoft.CodeAnalysis.Remote.Testing |
| 6 | + |
| 7 | +Namespace Microsoft.CodeAnalysis.Editor.UnitTests.FindReferences |
| 8 | + <Trait(Traits.Feature, Traits.Features.FindReferences)> |
| 9 | + Partial Public Class FindReferencesTests |
| 10 | + <WpfTheory, CombinatorialData> |
| 11 | + Public Async Function TestModernExtensionMethod1(kind As TestKind, host As TestHost) As Task |
| 12 | + Dim input = |
| 13 | +<Workspace> |
| 14 | + <Project Language="C#" CommonReferences="true" LanguageVersion="preview"> |
| 15 | + <Document><![CDATA[ |
| 16 | +using System; |
| 17 | +class Program |
| 18 | +{ |
| 19 | + static void Main(string[] args) |
| 20 | + { |
| 21 | + string s = "Hello"; |
| 22 | + s.[|$$ExtensionMethod|](); |
| 23 | + } |
| 24 | +} |
| 25 | + |
| 26 | + |
| 27 | +public static class MyExtension |
| 28 | +{ |
| 29 | + extension(string s) |
| 30 | + { |
| 31 | + public int {|Definition:ExtensionMethod|}() |
| 32 | + { |
| 33 | + return s.Length; |
| 34 | + } |
| 35 | + } |
| 36 | +} |
| 37 | +]]> |
| 38 | + </Document> |
| 39 | + </Project> |
| 40 | +</Workspace> |
| 41 | + Await TestAPIAndFeature(input, kind, host) |
| 42 | + End Function |
| 43 | + |
| 44 | + <WpfTheory, CombinatorialData> |
| 45 | + Public Async Function TestModernExtensionMethod2(kind As TestKind, host As TestHost) As Task |
| 46 | + Dim input = |
| 47 | +<Workspace> |
| 48 | + <Project Language="C#" CommonReferences="true" LanguageVersion="preview"> |
| 49 | + <Document><![CDATA[ |
| 50 | +using System; |
| 51 | +class Program |
| 52 | +{ |
| 53 | + static void Main(string[] args) |
| 54 | + { |
| 55 | + string s = "Hello"; |
| 56 | + string.[|$$ExtensionMethod|](); |
| 57 | + } |
| 58 | +} |
| 59 | + |
| 60 | + |
| 61 | +public static class MyExtension |
| 62 | +{ |
| 63 | + extension(string s) |
| 64 | + { |
| 65 | + public static int {|Definition:ExtensionMethod|}() |
| 66 | + { |
| 67 | + return 0; |
| 68 | + } |
| 69 | + } |
| 70 | +} |
| 71 | +]]> |
| 72 | + </Document> |
| 73 | + </Project> |
| 74 | +</Workspace> |
| 75 | + Await TestAPIAndFeature(input, kind, host) |
| 76 | + End Function |
| 77 | + |
| 78 | + <WpfTheory, CombinatorialData> |
| 79 | + Public Async Function TestModernExtensionProperty1(kind As TestKind, host As TestHost) As Task |
| 80 | + Dim input = |
| 81 | +<Workspace> |
| 82 | + <Project Language="C#" CommonReferences="true" LanguageVersion="preview"> |
| 83 | + <Document><![CDATA[ |
| 84 | +using System; |
| 85 | +class Program |
| 86 | +{ |
| 87 | + static void Main(string[] args) |
| 88 | + { |
| 89 | + string s = "Hello"; |
| 90 | + var v = s.[|$$ExtensionProp|]; |
| 91 | + } |
| 92 | +} |
| 93 | + |
| 94 | + |
| 95 | +public static class MyExtension |
| 96 | +{ |
| 97 | + extension(string s) |
| 98 | + { |
| 99 | + public int {|Definition:ExtensionProp|} => 0; |
| 100 | + } |
| 101 | +} |
| 102 | +]]> |
| 103 | + </Document> |
| 104 | + </Project> |
| 105 | +</Workspace> |
| 106 | + Await TestAPIAndFeature(input, kind, host) |
| 107 | + End Function |
| 108 | + End Class |
| 109 | +End Namespace |
0 commit comments