Skip to content

Commit

Permalink
Merge pull request #85 from godrose/develop
Browse files Browse the repository at this point in the history
chore: merge from develop
  • Loading branch information
godrose authored Sep 5, 2021
2 parents f30f433 + a1b60df commit 5c537f5
Show file tree
Hide file tree
Showing 85 changed files with 742 additions and 276 deletions.
4 changes: 2 additions & 2 deletions Solid.Bootstrapping.Specs/Solid.Bootstrapping.Specs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.0.0" />
<PackageReference Include="FluentAssertions" Version="6.1.0" />
<PackageReference Include="JetBrains.Annotations" Version="2021.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="SpecFlow" Version="3.9.22" />
<PackageReference Include="SpecFlow.Plus.LivingDocPlugin" Version="3.9.42" />
<PackageReference Include="SpecFlow.Plus.LivingDocPlugin" Version="3.9.50" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.9.22" />
<PackageReference Include="SpecFlow.xUnit" Version="3.9.22" />
<PackageReference Include="xunit.core" Version="2.4.1" />
Expand Down
20 changes: 19 additions & 1 deletion Solid.Bootstrapping/Middleware.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Linq;
using Solid.IoC.Registration;
using Solid.Practices.Composition.Contracts;
using Solid.Practices.IoC;
using Solid.Practices.Middleware;
Expand Down Expand Up @@ -179,7 +180,7 @@ public TBootstrapper Apply(
/// specified dependency registrator middleware.
/// </summary>
/// <typeparam name="TBootstrapper">The type of the bootstrapper.</typeparam>
/// <seealso cref="Solid.Practices.Middleware.IMiddleware{TBootstrapper}" />
/// <seealso cref="IMiddleware{TBootstrapper}" />
public class UseDependencyRegistratorMiddleware<TBootstrapper> : IMiddleware<TBootstrapper>
where TBootstrapper : class, IHaveRegistrator
{
Expand All @@ -202,4 +203,21 @@ public TBootstrapper Apply(
return @object;
}
}

/// <summary>
/// Adds support for default registration method for <see cref="IDependencyRegistrator"/>.
/// The default lifetime is singleton.
/// </summary>
/// <typeparam name="TBootstrapper"></typeparam>
public class UseDefaultRegistrationMethodMiddleware<TBootstrapper> : IMiddleware<TBootstrapper>
where TBootstrapper : class, IHaveRegistrator
{
/// <inheritdoc />
public TBootstrapper Apply(TBootstrapper @object)
{
RegistrationMethodContext.SetDefaultRegistrationMethod<IDependencyRegistrator>((dr, match) =>
dr.AddSingleton(match.ServiceType, match.ImplementationType));
return @object;
}
}
}
3 changes: 2 additions & 1 deletion Solid.Bootstrapping/Solid.Bootstrapping.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.3.1</Version>
<Version>2.3.2</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\Bin\netstandard\Release</OutputPath>
Expand All @@ -12,6 +12,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Solid.Common\Solid.Common.csproj" />
<ProjectReference Include="..\Solid.IoC.Registration\Solid.IoC.Registration.csproj" />
<ProjectReference Include="..\Solid.Practices.Composition.Contracts\Solid.Practices.Composition.Contracts.csproj" />
<ProjectReference Include="..\Solid.Practices.Composition\Solid.Practices.Composition.csproj" />
<ProjectReference Include="..\Solid.Practices.IoC\Solid.Practices.IoC.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion Solid.Common.Platform/net/Solid.Common.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.3.1</Version>
<Version>2.3.2</Version>
<AssemblyName>Solid.Common.Platform</AssemblyName>
<RootNamespace>Solid.Common</RootNamespace>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Solid.Common.Platform/netcore/Solid.Common.NETCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.3.1</Version>
<Version>2.3.2</Version>
<AssemblyName>Solid.Common.Platform</AssemblyName>
<RootNamespace>Solid.Common</RootNamespace>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions Solid.Common.Platform/netframework/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.3.1")]
[assembly: AssemblyFileVersion("2.3.1")]
[assembly: AssemblyVersion("2.3.2")]
[assembly: AssemblyFileVersion("2.3.2")]
4 changes: 2 additions & 2 deletions Solid.Common.Platform/uwp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.3.1")]
[assembly: AssemblyFileVersion("2.3.1")]
[assembly: AssemblyVersion("2.3.2")]
[assembly: AssemblyFileVersion("2.3.2")]
[assembly: ComVisible(false)]
2 changes: 1 addition & 1 deletion Solid.Common/Solid.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.3.1</Version>
<Version>2.3.2</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\Bin\netstandard\Release</OutputPath>
Expand Down
2 changes: 1 addition & 1 deletion Solid.Core.Tests/Solid.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.0.0" />
<PackageReference Include="FluentAssertions" Version="6.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
Expand Down
2 changes: 1 addition & 1 deletion Solid.Core/Solid.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.3.1</Version>
<Version>2.3.2</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\Bin\netstandard\Release</OutputPath>
Expand Down
28 changes: 5 additions & 23 deletions Solid.Extensibility.Specs/Solid.Extensibility.Specs.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.0.0" />
<PackageReference Include="FluentAssertions" Version="6.1.0" />
<PackageReference Include="JetBrains.Annotations" Version="2021.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="SpecFlow" Version="3.9.22" />
<PackageReference Include="SpecFlow.Plus.LivingDocPlugin" Version="3.9.42" />
<PackageReference Include="SpecFlow.Plus.LivingDocPlugin" Version="3.9.50" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.9.22" />
<PackageReference Include="SpecFlow.xUnit" Version="3.9.22" />
<PackageReference Include="xunit.core" Version="2.4.1" />
Expand All @@ -23,28 +23,10 @@
<ProjectReference Include="..\Solid.Extensibility\Solid.Extensibility.csproj" />
<ProjectReference Include="..\Solid.IoC.Adapters.BoDi\Solid.IoC.Adapters.BoDi.csproj" />
<ProjectReference Include="..\Solid.Tests.Infra\Solid.Tests.Infra.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Middleware Types.feature.cs">
<DesignTime>True</DesignTime>
</Compile>
<Compile Update="Using extensibility by type as Aspect.feature.cs">
<DesignTime>True</DesignTime>
</Compile>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<None Update="specflow.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<SpecFlowFeatureFiles Update="Middleware Types.feature">
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>Middleware Types.feature.cs</LastGenOutput>
</SpecFlowFeatureFiles>
<SpecFlowFeatureFiles Update="Using extensibility by type as Aspect.feature">
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>Using extensibility by type as Aspect.feature.cs</LastGenOutput>
</SpecFlowFeatureFiles>
</ItemGroup>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Solid.Extensibility/Solid.Extensibility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.3.1</Version>
<Version>2.3.2</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\Bin\netstandard\Release</OutputPath>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.0.0" />
<PackageReference Include="FluentAssertions" Version="6.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="SpecFlow" Version="3.9.22" />
<PackageReference Include="SpecFlow.Plus.LivingDocPlugin" Version="3.9.42" />
<PackageReference Include="SpecFlow.Plus.LivingDocPlugin" Version="3.9.50" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.9.22" />
<PackageReference Include="SpecFlow.xUnit" Version="3.9.22" />
<PackageReference Include="xunit.core" Version="2.4.1" />
Expand Down
2 changes: 1 addition & 1 deletion Solid.IoC.Adapters.BoDi/Solid.IoC.Adapters.BoDi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.3.1</Version>
<Version>2.3.2</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\Bin\netstandard\Release</OutputPath>
Expand Down
7 changes: 7 additions & 0 deletions Solid.IoC.Registration.Specs.Tests.Contracts/IDependency.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Solid.IoC.Registration.Specs.Tests.Contracts
{
public interface IDependency
{

}
}
7 changes: 7 additions & 0 deletions Solid.IoC.Registration.Specs.Tests.Contracts/ObjectBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Solid.IoC.Registration.Specs.Tests.Contracts
{
public abstract class ObjectBase
{

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Solid.IoC.Registration.Specs.Tests.Contracts;

namespace Solid.IoC.Registration.Specs.Tests.Implementations
{
public class Dependency : IDependency
{

}
}
43 changes: 33 additions & 10 deletions Solid.IoC.Registration.Specs/Automagical Registration.feature
Original file line number Diff line number Diff line change
@@ -1,22 +1,45 @@
Feature: Automagical Registration
@cleanRegistrationMethodContext
Feature: Automagical Registration
In order to simplify IoC implementation in my apps
As an app developer
I want to be able to register dependencies automagically

Scenario: Registering dependencies automagically by ending should allow successful resolution
Scenario Outline: Registering dependencies automagically by ending should allow successful resolution
Given There are valid implementations for all declared dependencies
When I use object container
When I use '<container name>'
When I use registration by ending
Then All dependencies can be resolved successfully
Then All dependencies by ending can be resolved successfully
Examples:
| container name |
| specflow object container |
| microsoft di container |

Scenario: Registering dependencies automagically by contract which is an interface should allow successful resolution
Scenario Outline: Registering dependencies automagically by contract which is an interface should allow successful resolution
Given There are valid implementations for all declared dependencies
When I use object container
When I use '<container name>'
When I use registration by contract which is an interface
Then All dependencies can be resolved successfully
Then All dependencies by contract which is an interface can be resolved successfully
Examples:
| container name |
| specflow object container |
| microsoft di container |

Scenario: Registering dependencies automagically by contract which is a class should allow successful resolution
Scenario Outline: Registering dependencies automagically by contract which is a class should allow successful resolution
Given There are valid implementations for all declared dependencies
When I use object container
When I use '<container name>'
When I use registration by contract which is a class
Then All dependencies can be resolved successfully
Then All dependencies by contract which is a class can be resolved successfully
Examples:
| container name |
| specflow object container |
| microsoft di container |

Scenario Outline: Registering all dependencies automagically with implicit default registration method should allow successful resolution for all dependencies
Given There are valid implementations for all declared dependencies
When I use '<container name>' with default registration method
When I use automagical registration
Then All dependencies can be resolved successfully
Examples:
| container name |
| specflow object container |
| microsoft di container |
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Reflection;
using Attest.Testing.SpecFlow;
using Microsoft.Extensions.DependencyInjection;
using Solid.Practices.IoC;
using TechTalk.SpecFlow;

Expand All @@ -17,10 +18,34 @@ public Assembly[] Assemblies
set => SetValue(value);
}

public Assembly ContractsAssembly
{
get => GetValue<Assembly>();
set => SetValue(value);
}

public Assembly ImplementationsAssembly
{
get => GetValue<Assembly>();
set => SetValue(value);
}

public IIocContainer IocContainer
{
get => GetValue<IIocContainer>();
set => SetValue(value);
}

public IServiceCollection DiContainer
{
get => GetValue<IServiceCollection>();
set => SetValue(value);
}

public string ContainerName
{
get => GetValue<string>();
set => SetValue(value);
}
}
}
Loading

0 comments on commit 5c537f5

Please sign in to comment.