Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #20 from asbjornu/no-object-factory
Browse files Browse the repository at this point in the history
Don't use ObjectFactory
  • Loading branch information
grumpydev committed Oct 7, 2014
2 parents d53dd8a + 4da6703 commit cac6bfc
Show file tree
Hide file tree
Showing 4 changed files with 261 additions and 254 deletions.
@@ -0,0 +1,14 @@
namespace Nancy.Bootstrappers.StructureMap.Tests
{
using Nancy.Routing;

public class FakeNancyModuleWithRouteCacheProviderDependency : NancyModule
{
public IRouteCacheProvider RouteCacheProvider { get; private set; }

public FakeNancyModuleWithRouteCacheProviderDependency(IRouteCacheProvider routeCacheProvider)
{
RouteCacheProvider = routeCacheProvider;
}
}
}
Expand Up @@ -72,6 +72,7 @@
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="BootstrapperBaseFixture.cs" />
<Compile Include="FakeNancyModuleWithRouteCacheProviderDependency.cs" />
<Compile Include="FakeStructureMapNancyBootstrapper.cs" />
<Compile Include="StructureMapNancyBootstrapperFixture.cs" />
</ItemGroup>
Expand Down
Expand Up @@ -104,6 +104,21 @@ public void Should_not_return_the_same_instance_when_getmodule_is_called_multipl
result.FooDependency.ShouldNotBeSameAs(result2.FooDependency);
}

[Fact]
public void Should_resolve_module_with_dependency_on_RouteCacheFactory()
{
// Given
this.bootstrapper.GetEngine();
var context = new NancyContext();

// When
var result = this.bootstrapper.GetModule(typeof(FakeNancyModuleWithRouteCacheProviderDependency), context) as FakeNancyModuleWithRouteCacheProviderDependency;

// Then
result.RouteCacheProvider.ShouldNotBeNull();
result.RouteCacheProvider.ShouldBeOfType(typeof(DefaultRouteCacheProvider));
}

public void Dispose()
{
this.bootstrapper.Dispose();
Expand Down

0 comments on commit cac6bfc

Please sign in to comment.