/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/Metadata/PE/LoadingWithEvents.vb
57 строк
2 KB
Tomáš Matoušek
Refactoring of extension methods in source packages (#78620) - take 2 (#78894)
26 июн 2025, 18:42
Не верифицирован
26 июн 2025, 18:42
05fc006
Код
Авторство
О чём код?
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Symbols.Metadata.PE Public Class LoadingWithEvents : Inherits BasicTestBase <Fact> Public Sub LoadingSimpleWithEvents1() Dim source = <compilation name="LoadingSimpleWithEvents1"> <file name="a.vb"> </file> </compilation> Dim simpleWithEvents = MetadataReference.CreateFromImage(TestResources.SymbolsTests.WithEvents.SimpleWithEvents.AsImmutableOrNull()) Dim c1 = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(source, {simpleWithEvents}, TestOptions.ReleaseExe) Dim ns = DirectCast(c1.GlobalNamespace.GetMembers("SimpleWithEvents").Single, NamespaceSymbol) Dim Class1 = ns.GetTypeMembers("Class1").Single Dim Class1_WE1 = DirectCast(Class1.GetMember("WE1"), PropertySymbol) Dim Class1_WE2 = DirectCast(Class1.GetMember("WE2"), PropertySymbol) Assert.True(Class1_WE1.IsWithEvents) Assert.True(Class1_WE2.IsWithEvents) End Sub <Fact> Public Sub LoadingSimpleWithEventsDerived() Dim source = <compilation name="LoadingSimpleWithEvents1"> <file name="a.vb"> </file> </compilation> Dim ref = MetadataReference.CreateFromImage(TestResources.SymbolsTests.WithEvents.SimpleWithEvents.AsImmutableOrNull()) Dim c1 = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(source, {ref}, TestOptions.ReleaseExe) Dim ns = DirectCast(c1.GlobalNamespace.GetMembers("SimpleWithEvents").Single, NamespaceSymbol) Dim Derived = ns.GetTypeMembers("Derived").Single Dim Derived_WE1 = DirectCast(Derived.GetMember("WE1"), PropertySymbol) Assert.True(Derived_WE1.IsWithEvents) Assert.True(Derived_WE1.IsOverrides) Assert.True(Derived_WE1.OverriddenProperty.IsWithEvents) End Sub End Class End Namespace