Skip to content

Commit

Permalink
Merge pull request #52 from ekonbenefits/makebuildproxy-instance
Browse files Browse the repository at this point in the history
Refactor to allow a collectable version of impromptu interface
  • Loading branch information
jbtule authored Nov 7, 2023
2 parents bbb4950 + ff410fa commit 7bee84f
Show file tree
Hide file tree
Showing 26 changed files with 2,228 additions and 2,306 deletions.
79 changes: 0 additions & 79 deletions .appveyor.yml

This file was deleted.

76 changes: 0 additions & 76 deletions .github/workflows/codeql.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build .net core

on: [push]

jobs:
build:
name: Test ${{ matrix.os }} for dotnet ${{ matrix.dotnet }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
dotnet: [ '6.0.x' ]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Build with dotnet core
run: dotnet build --configuration Release
- name: Tests
run: dotnet test Tests/UnitTestImpromptuInterface/UnitTestImpromptuInterface.csproj --configuration Release --no-build --no-restore --filter=TestCategory!=Performance
30 changes: 30 additions & 0 deletions .github/workflows/dotnet48.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build CrossComple .net core/.net framework Windows

on: [push]

jobs:
build:
name: Test Windows .net Framework Only
runs-on: windows-2019
steps:

- uses: actions/checkout@v2

- name: Setup NuGet
uses: NuGet/[email protected]

- name: setup-msbuild
uses: microsoft/[email protected]

- name: Restore Packages
run: nuget restore ImpromptuInterface.sln
- name: Build solution
run: msbuild ImpromptuInterface.sln -t:rebuild -property:Configuration=Release
- name: Run vstests
uses: microsoft/[email protected]
with:
testAssembly: UnitTestImpromptuInterface.dll
searchFolder: .\Tests\UnitTestImpromptuInterface\bin\Release\*\
runInParallel: true
otherConsoleOptions: /TestCaseFilter:"(TestCategory!=Performance)"
platform: x64
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

26 changes: 9 additions & 17 deletions ImpromptuInterface.sln
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.3
# Visual Studio Version 17
VisualStudioVersion = 17.7.34202.233
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnitTests", "UnitTests", "{983B9C01-EB2E-49E3-BB3E-A3FD41858F8C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImpromptuInterface", "ImpromptuInterface\ImpromptuInterface.csproj", "{DAB7C056-660A-4153-8FF2-B80A41310AD7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestSupportLibrary", "Tests\UnitTestSupportLibrary\UnitTestSupportLibrary.csproj", "{0EC76091-958A-4020-BA6B-39B00EE55659}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTestSupportLibrary", "Tests\UnitTestSupportLibrary\UnitTestSupportLibrary.csproj", "{0EC76091-958A-4020-BA6B-39B00EE55659}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestImpromptuInterface", "Tests\UnitTestImpromptuInterface\UnitTestImpromptuInterface.csproj", "{A559B4F8-8D9D-4761-B2D2-BB4104760450}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTestImpromptuInterface", "Tests\UnitTestImpromptuInterface\UnitTestImpromptuInterface.csproj", "{A559B4F8-8D9D-4761-B2D2-BB4104760450}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestImpromptuInterface.Clay", "Tests\UnitTestImpromptuInterface.Clay\UnitTestImpromptuInterface.Clay.csproj", "{15A061C0-A102-460E-A70A-0AFFE49B364E}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{87291621-4395-4EFE-A070-9A007B26EF6D}"
ProjectSection(SolutionItems) = preProject
Version.props = Version.props
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -53,28 +56,17 @@ Global
{A559B4F8-8D9D-4761-B2D2-BB4104760450}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{A559B4F8-8D9D-4761-B2D2-BB4104760450}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A559B4F8-8D9D-4761-B2D2-BB4104760450}.Release|x86.ActiveCfg = Release|Any CPU
{15A061C0-A102-460E-A70A-0AFFE49B364E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{15A061C0-A102-460E-A70A-0AFFE49B364E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{15A061C0-A102-460E-A70A-0AFFE49B364E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{15A061C0-A102-460E-A70A-0AFFE49B364E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{15A061C0-A102-460E-A70A-0AFFE49B364E}.Debug|x86.ActiveCfg = Debug|Any CPU
{15A061C0-A102-460E-A70A-0AFFE49B364E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{15A061C0-A102-460E-A70A-0AFFE49B364E}.Release|Any CPU.Build.0 = Release|Any CPU
{15A061C0-A102-460E-A70A-0AFFE49B364E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{15A061C0-A102-460E-A70A-0AFFE49B364E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{15A061C0-A102-460E-A70A-0AFFE49B364E}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{0EC76091-958A-4020-BA6B-39B00EE55659} = {983B9C01-EB2E-49E3-BB3E-A3FD41858F8C}
{A559B4F8-8D9D-4761-B2D2-BB4104760450} = {983B9C01-EB2E-49E3-BB3E-A3FD41858F8C}
{15A061C0-A102-460E-A70A-0AFFE49B364E} = {983B9C01-EB2E-49E3-BB3E-A3FD41858F8C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35
SolutionGuid = {D1E8E4C0-DCFC-45E7-9A4F-8E2B079E49B4}
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Test\Test.csproj
Expand Down
1 change: 1 addition & 0 deletions ImpromptuInterface.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EdotCover_002EIde_002ECore_002EFilterManagement_002EModel_002ESolutionFilterSettingsManagerMigrateSettings/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String>
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String></wpf:ResourceDictionary>
6 changes: 3 additions & 3 deletions ImpromptuInterface/ImpromptuInterface.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
</PropertyGroup>
<Import Project="..\Version.props" />
<ItemGroup>
<PackageReference Include="Dynamitey" Version="2.0.*" />
<PackageReference Include="Dynamitey" Version="3.0.2" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net40'">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<PackageReference Include="System.Reflection.Emit" Version="4.3.*" />
<PackageReference Include="Microsoft.CSharp" Version="4.4.*" />
<PackageReference Include="System.Reflection.Emit" Version="4.*" />
<PackageReference Include="Microsoft.CSharp" Version="4.*" />
</ItemGroup>
</Project>
6 changes: 5 additions & 1 deletion ImpromptuInterface/src/ActLikeCaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Reflection.Emit;
using System.Runtime.Serialization;
using System.Text;
using ImpromptuInterface.Build;

namespace ImpromptuInterface
{
Expand All @@ -13,14 +15,16 @@ public class ActLikeCaster: DynamicObject
public object Target { get; }
private List<Type> _interfaceTypes;

public ActLikeMaker Maker {get;set;} = BuildProxy.DefaultProxyMaker;

public override bool TryConvert(System.Dynamic.ConvertBinder binder, out object result)
{
result = null;

if (binder.Type.IsInterface)
{
_interfaceTypes.Insert(0, binder.Type);
result = Impromptu.DynamicActLike(Target, _interfaceTypes.ToArray());
result = Maker.DynamicActLike(Target, _interfaceTypes.ToArray());
return true;
}

Expand Down
Loading

0 comments on commit 7bee84f

Please sign in to comment.