-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed VB style async builder handling
- Loading branch information
Showing
5 changed files
with
103 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tests/AspectInjector.Tests.VBRuntime/AspectInjector.Tests.VBRuntime.vbproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0;net471;net461</TargetFrameworks> | ||
<Configurations>Debug;Release;DebugTests</Configurations> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" /> | ||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\AspectInjector.Broker\AspectInjector.Broker.csproj" /> | ||
<ProjectReference Include="..\AspectInjector.Tests.RuntimeAssets\AspectInjector.Tests.RuntimeAssets.csproj" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Imports AspectInjector.Broker | ||
Imports AspectInjector.Tests.Assets | ||
Imports Xunit | ||
|
||
Namespace AspectInjector.Tests.VBRuntime | ||
|
||
Public Class Issue_0182 | ||
|
||
<Fact> | ||
Public Async Sub AdviceBefore_Methods_Passes() | ||
Dim vb = New TestClassVbAspect() | ||
Dim result = Await vb.TestAsyncMethod("Test") | ||
Assert.Equal("Test", result) | ||
End Sub | ||
|
||
Partial Friend NotInheritable Class TestClassVbAspect | ||
<InjectInstanceAspect> | ||
Public Async Function TestAsyncMethod(Of T)(ByVal obj As T) As Task(Of T) | ||
Return Await Task.FromResult(obj) | ||
End Function | ||
End Class | ||
|
||
<AttributeUsage(AttributeTargets.All, AllowMultiple:=True)> | ||
<Injection(GetType(InstanceAspect))> | ||
Public Class InjectInstanceAspect | ||
Inherits Attribute | ||
End Class | ||
|
||
<Aspect(Scope.PerInstance)> | ||
Public Class InstanceAspect | ||
Inherits TestAspectBase | ||
|
||
<Advice(Kind.After)> | ||
Public Sub AspectMethod() | ||
End Sub | ||
|
||
End Class | ||
|
||
End Class | ||
|
||
End Namespace | ||
|