Skip to content

Commit

Permalink
Fixed overload which called Dependency<object>
Browse files Browse the repository at this point in the history
  • Loading branch information
khellang committed Apr 25, 2015
1 parent 8ade7bc commit 23183a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ interface IIinterface { }
class DisposableDependency : IIinterface, IDisposable
{
public bool Disposed { get; private set; }

public void Dispose()
{
this.Disposed = true;
Expand Down Expand Up @@ -125,7 +125,7 @@ public void should_be_able_to_configure_dependencies_by_instances()
var browser = new Browser(with =>
{
with.Module<ModuleWithTwoDependencies>();
with.Dependencies(GetFakeDependency(), GetFakeDependency2());
with.Dependencies<object>(GetFakeDependency(), GetFakeDependency2());
});

// When
Expand Down
32 changes: 3 additions & 29 deletions src/Nancy.Testing/ConfigurableBootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -695,32 +695,6 @@ private static IEnumerable<Type> GetSafeInterfaces(Type type)
return type.GetInterfaces().Where(x => x != typeof(IDisposable));
}

/// <summary>
/// Configures the bootstrapper to register the specified type as a dependency.
/// </summary>
/// <typeparam name="T">The type that the dependencies should be registered as.</typeparam>
/// <returns>A reference to the current <see cref="ConfigurableBootstrapperConfigurator"/>.</returns>
public ConfigurableBootstrapperConfigurator Dependency<T>(object instance)
{
this.bootstrapper.registeredInstances.Add(new InstanceRegistration(typeof(T), instance));
return this;
}

/// <summary>
/// Configures the bootstrapper to register the specified instances as a dependencies.
/// </summary>
/// <param name="dependencies">The instances of the dependencies that should be registered with the bootstrapper.</param>
/// <returns>A reference to the current <see cref="ConfigurableBootstrapperConfigurator"/>.</returns>
public ConfigurableBootstrapperConfigurator Dependencies(params object[] dependencies)
{
foreach (var dependency in dependencies)
{
this.Dependency(dependency);
}

return this;
}

/// <summary>
/// Configures the bootstrapper to register the specified types and instances as a dependencies.
/// </summary>
Expand All @@ -745,11 +719,11 @@ public ConfigurableBootstrapperConfigurator MappedDependencies<T, K>(IEnumerable
/// <param name="dependencies">The instances of the dependencies that should be registered with the bootstrapper.</param>
/// <typeparam name="T">The type that the dependencies should be registered as.</typeparam>
/// <returns>A reference to the current <see cref="ConfigurableBootstrapperConfigurator"/>.</returns>
public ConfigurableBootstrapperConfigurator Dependencies<T>(params object[] dependencies)
public ConfigurableBootstrapperConfigurator Dependencies<T>(params T[] dependencies)
{
foreach (var dependency in dependencies)
{
this.Dependency<T>(dependency);
this.Dependency(dependency);
}

return this;
Expand Down Expand Up @@ -1057,7 +1031,7 @@ public ConfigurableBootstrapperConfigurator RouteCacheProvider<T>() where T : IR
return this;
}

/// <summary>
/// <summary>
/// Configures the bootstrapper to use the provided instance of <see cref="IRootPathProvider"/>.
/// </summary>
/// <param name="rootPathProvider">The <see cref="IRootPathProvider"/> instance that should be used by the bootstrapper.</param>
Expand Down

0 comments on commit 23183a2

Please sign in to comment.