Skip to content

Commit bb71dbd

Browse files
committed
Refactoring
1 parent 25d9767 commit bb71dbd

File tree

10 files changed

+42
-12
lines changed

10 files changed

+42
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using System.Reflection;
2-
using Attest.Testing.Contracts;
3-
using Attest.Testing.Integration;
42
using JetBrains.Annotations;
53
using Samples.Specifications.Tests.Contracts;
4+
using Samples.Specifications.Tests.Infra;
65
using Solid.Practices.IoC;
76
using Solid.Practices.Modularity;
87

@@ -15,10 +14,9 @@ public void RegisterModule(IDependencyRegistrator dependencyRegistrator)
1514
{
1615
dependencyRegistrator
1716
.RegisterAutomagically(
18-
Assembly.LoadFrom(AssemblyInfo.AssemblyName),
19-
Assembly.GetExecutingAssembly())
20-
.AddSingleton<IStartLocalApplicationService, StartLocalApplicationService>()
21-
.AddSingleton<ITeardownService, TeardownService>();
17+
Assembly.LoadFrom(AssemblyInfo.AssemblyName),
18+
Assembly.GetExecutingAssembly())
19+
.UseLocalApplicationForIntegration();
2220
}
23-
}
21+
}
2422
}

Samples.Specifications.Client.Tests.Integration/Samples.Specifications.Client.Tests.Integration.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@
110110
<Project>{1677d87b-7e7b-436e-8e71-e98a242b89b4}</Project>
111111
<Name>Samples.Specifications.Tests.Data</Name>
112112
</ProjectReference>
113+
<ProjectReference Include="..\Samples.Specifications.Tests.Infra\Samples.Specifications.Tests.Infra.csproj">
114+
<Project>{1e03f181-2690-4ea6-8b99-975d6da4e759}</Project>
115+
<Name>Samples.Specifications.Tests.Infra</Name>
116+
</ProjectReference>
113117
</ItemGroup>
114118
<ItemGroup>
115119
<None Include="app.config">
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Attest.Testing.Contracts;
2-
using Attest.Testing.EndToEnd;
32
using JetBrains.Annotations;
3+
using Samples.Specifications.Tests.Infra;
44
using Solid.Practices.IoC;
55
using Solid.Practices.Modularity;
66

@@ -10,7 +10,7 @@ namespace Samples.Specifications.Tests.EndToEnd
1010
internal sealed class Module : ICompositionModule<IDependencyRegistrator>
1111
{
1212
public void RegisterModule(IDependencyRegistrator dependencyRegistrator) => dependencyRegistrator
13-
.AddSingleton<IApplicationPathInfo, ApplicationPathInfo>()
14-
.AddSingleton<IStartLocalApplicationService, StartLocalApplicationService>();
13+
.AddSingleton<IApplicationPathInfo, ApplicationPathInfo>()
14+
.UseLocalApplicationForEndToEnd();
1515
}
1616
}

Samples.Specifications.Tests.EndToEnd/Samples.Specifications.Tests.EndToEnd.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,8 @@
3232
<PackageReference Include="Solid.Practices.Modularity" Version="2.0.0-rc1" />
3333
</ItemGroup>
3434

35+
<ItemGroup>
36+
<ProjectReference Include="..\Samples.Specifications.Tests.Infra\Samples.Specifications.Tests.Infra.csproj" />
37+
</ItemGroup>
38+
3539
</Project>

Samples.Specifications.Tests.Infra.Launcher/Startup.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void Initialize()
2121
.Use(new RegisterResolverMiddleware<Bootstrapper>(_iocContainer))
2222
.Use(new RegisterCollectionMiddleware<Bootstrapper, IDynamicApplicationModule>())
2323
.Use(new RegisterCollectionMiddleware<Bootstrapper, IStaticApplicationModule>())
24-
.Use(new RegisterCollectionMiddleware<Bootstrapper, ITeardownService>());
24+
.Use(new RegisterCollectionMiddleware<Bootstrapper, ITeardownService>());
2525
bootstrapper.Use(new UseApplicationModulesMiddleware());
2626
bootstrapper.Initialize();
2727
}

Samples.Specifications.Tests.Infra.Launcher/UseApplicationModulesMiddleware.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ public IHaveRegistrator Apply(IHaveRegistrator @object)
1818
.AddSingleton<IStaticSetupService, StaticSetupService>();
1919
return @object;
2020
}
21-
}
21+
}
2222
}

Samples.Specifications.Tests.Infra/DelegateExtensions.cs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Samples.Specifications.Tests.Infra
66
{
7+
//TODO: Move to packages
78
public static class DelegateExtensions
89
{
910
public static void Execute(this Action action) =>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Attest.Testing.Contracts;
2+
using Solid.Practices.IoC;
3+
4+
namespace Samples.Specifications.Tests.Infra
5+
{
6+
//TODO: Move to packages
7+
public static class RegistratorExtensions
8+
{
9+
public static IDependencyRegistrator UseLocalApplicationForIntegration(this IDependencyRegistrator dependencyRegistrator)
10+
{
11+
dependencyRegistrator.RegisterSingleton<IStartLocalApplicationService, Attest.Testing.Integration.StartLocalApplicationService>();
12+
return dependencyRegistrator;
13+
}
14+
15+
public static IDependencyRegistrator UseLocalApplicationForEndToEnd(this IDependencyRegistrator dependencyRegistrator)
16+
{
17+
dependencyRegistrator.RegisterSingleton<IStartLocalApplicationService, Attest.Testing.EndToEnd.StartLocalApplicationService>();
18+
return dependencyRegistrator;
19+
}
20+
}
21+
}

Samples.Specifications.Tests.Infra/Samples.Specifications.Tests.Infra.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
</PropertyGroup>
3636

3737
<ItemGroup>
38+
<PackageReference Include="Attest.Tests.Core" Version="2.0.0-rc2" />
3839
<PackageReference Include="JetBrains.Annotations" Version="2018.2.1" />
3940
<PackageReference Include="Solid.Practices.Modularity" Version="2.0.0-rc1" />
4041
<PackageReference Include="System.Management" Version="4.5.0" />

Samples.Specifications.Tests.Infra/WindowsProcessManagementService.cs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Samples.Specifications.Tests.Infra
88
{
9+
//TODO: Move to packages
910
[UsedImplicitly]
1011
internal sealed class WindowsProcessManagementService : IProcessManagementService
1112
{

0 commit comments

Comments
 (0)