Skip to content

Commit 97d10db

Browse files
committed
Experimenting with a delegate based plugin catalog
1 parent 09f6959 commit 97d10db

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

src/PluginFramework.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Weikio.PluginFramework", "W
44
EndProject
55
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Weikio.PluginFramework.Abstractions", "Weikio.PluginFramework.Abstractions\Weikio.PluginFramework.Abstractions.csproj", "{5C264288-C384-48A3-AF94-850D98830E13}"
66
EndProject
7+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Weikio.PluginFramework.Tests", "..\tests\unit\Weikio.PluginFramework.Tests\Weikio.PluginFramework.Tests.csproj", "{6CDBFF3C-932B-4A66-8779-B5C72B33AF7F}"
8+
EndProject
79
Global
810
GlobalSection(SolutionConfigurationPlatforms) = preSolution
911
Debug|Any CPU = Debug|Any CPU
@@ -18,5 +20,9 @@ Global
1820
{5C264288-C384-48A3-AF94-850D98830E13}.Debug|Any CPU.Build.0 = Debug|Any CPU
1921
{5C264288-C384-48A3-AF94-850D98830E13}.Release|Any CPU.ActiveCfg = Release|Any CPU
2022
{5C264288-C384-48A3-AF94-850D98830E13}.Release|Any CPU.Build.0 = Release|Any CPU
23+
{6CDBFF3C-932B-4A66-8779-B5C72B33AF7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24+
{6CDBFF3C-932B-4A66-8779-B5C72B33AF7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
25+
{6CDBFF3C-932B-4A66-8779-B5C72B33AF7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
26+
{6CDBFF3C-932B-4A66-8779-B5C72B33AF7F}.Release|Any CPU.Build.0 = Release|Any CPU
2127
EndGlobalSection
2228
EndGlobal
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using System;
2+
using System.Reflection;
3+
using System.Threading.Tasks;
4+
using Xunit;
5+
6+
namespace Weikio.PluginFramework.Tests
7+
{
8+
public class TestClass
9+
{
10+
11+
}
12+
13+
public class Test
14+
{
15+
// Roslyn generated?
16+
public dynamic Configuration { get; set; }
17+
18+
[Fact]
19+
public void MyTest()
20+
{
21+
var myFuncTest = new Func<string, int, string>((s, i) =>
22+
{
23+
var y = s + i;
24+
25+
return y;
26+
});
27+
28+
var myActionTest = new Action<string, int>((s, i) =>
29+
{
30+
var y = s + i;
31+
});
32+
33+
var asyncTest = new Action<Task<string>, int>(async (Task<string> s, int i) =>
34+
{
35+
var d = await s;
36+
var y = d + i;
37+
});
38+
39+
Create(myFuncTest);
40+
Create(myActionTest);
41+
Create(asyncTest);
42+
}
43+
44+
public void Create(MulticastDelegate multicastDelegate)
45+
{
46+
var methodInfo = multicastDelegate.GetMethodInfo();
47+
48+
var parameters = methodInfo.GetParameters();
49+
var returnType = methodInfo.ReturnType;
50+
}
51+
}
52+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.*" />
9+
<PackageReference Include="xunit" Version="2.4.*" />
10+
<PackageReference Include="xunit.runner.visualstudio" Version="2.*" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<ProjectReference Include="..\..\..\src\Weikio.PluginFramework\Weikio.PluginFramework.csproj" />
15+
</ItemGroup>
16+
17+
</Project>

0 commit comments

Comments
 (0)