From 23183a21d2df73aaf72b57edfbd199f54728341e Mon Sep 17 00:00:00 2001 From: Kristian Hellang Date: Sat, 25 Apr 2015 09:27:15 +0200 Subject: [PATCH] Fixed overload which called Dependency --- ...nfigurableBootstrapperDependenciesTests.cs | 4 +-- src/Nancy.Testing/ConfigurableBootstrapper.cs | 32 ++----------------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/src/Nancy.Testing.Tests/ConfigurableBootstrapperDependenciesTests.cs b/src/Nancy.Testing.Tests/ConfigurableBootstrapperDependenciesTests.cs index 7771f83e79..1108f577d9 100644 --- a/src/Nancy.Testing.Tests/ConfigurableBootstrapperDependenciesTests.cs +++ b/src/Nancy.Testing.Tests/ConfigurableBootstrapperDependenciesTests.cs @@ -95,7 +95,7 @@ interface IIinterface { } class DisposableDependency : IIinterface, IDisposable { public bool Disposed { get; private set; } - + public void Dispose() { this.Disposed = true; @@ -125,7 +125,7 @@ public void should_be_able_to_configure_dependencies_by_instances() var browser = new Browser(with => { with.Module(); - with.Dependencies(GetFakeDependency(), GetFakeDependency2()); + with.Dependencies(GetFakeDependency(), GetFakeDependency2()); }); // When diff --git a/src/Nancy.Testing/ConfigurableBootstrapper.cs b/src/Nancy.Testing/ConfigurableBootstrapper.cs index f4e6742283..1edf98627b 100644 --- a/src/Nancy.Testing/ConfigurableBootstrapper.cs +++ b/src/Nancy.Testing/ConfigurableBootstrapper.cs @@ -695,32 +695,6 @@ private static IEnumerable GetSafeInterfaces(Type type) return type.GetInterfaces().Where(x => x != typeof(IDisposable)); } - /// - /// Configures the bootstrapper to register the specified type as a dependency. - /// - /// The type that the dependencies should be registered as. - /// A reference to the current . - public ConfigurableBootstrapperConfigurator Dependency(object instance) - { - this.bootstrapper.registeredInstances.Add(new InstanceRegistration(typeof(T), instance)); - return this; - } - - /// - /// Configures the bootstrapper to register the specified instances as a dependencies. - /// - /// The instances of the dependencies that should be registered with the bootstrapper. - /// A reference to the current . - public ConfigurableBootstrapperConfigurator Dependencies(params object[] dependencies) - { - foreach (var dependency in dependencies) - { - this.Dependency(dependency); - } - - return this; - } - /// /// Configures the bootstrapper to register the specified types and instances as a dependencies. /// @@ -745,11 +719,11 @@ public ConfigurableBootstrapperConfigurator MappedDependencies(IEnumerable /// The instances of the dependencies that should be registered with the bootstrapper. /// The type that the dependencies should be registered as. /// A reference to the current . - public ConfigurableBootstrapperConfigurator Dependencies(params object[] dependencies) + public ConfigurableBootstrapperConfigurator Dependencies(params T[] dependencies) { foreach (var dependency in dependencies) { - this.Dependency(dependency); + this.Dependency(dependency); } return this; @@ -1057,7 +1031,7 @@ public ConfigurableBootstrapperConfigurator RouteCacheProvider() where T : IR return this; } - /// + /// /// Configures the bootstrapper to use the provided instance of . /// /// The instance that should be used by the bootstrapper.