Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

Browser with.Dependencies(..) broken? #1909

Closed
PureKrome opened this issue Apr 25, 2015 · 4 comments · Fixed by #1910
Closed

Browser with.Dependencies(..) broken? #1909

PureKrome opened this issue Apr 25, 2015 · 4 comments · Fixed by #1910
Assignees
Milestone

Comments

@PureKrome
Copy link
Contributor

Notice: I'm not sure if this issue is related to #1862 or this is a TinyIOC issue and should be raised there.

When testing a route using Nancy.Testing and using with.Dependencies(someCollectionOfDependencies); it fails to correctly set them up.

As a work around, I need to iterate through each one and with.Dependency(someDependency); and that works.

for example ..

Fails

var browser = new Browser(with =>
{
    with.Module<MyModule>();
    with.Dependencies(dependencies); // a collection of `x` dep's.
});

Succeeds

var browser = new Browser(with =>
{
    with.Module<MyModule>();
    foreach(var dependency in dependencies)
    {
        with.Dependency(dependency);
    }
});

btw, the collection dependencies are identical.

Lastly, this is with version 1.2 of Nancy, etc.

@horsdal
Copy link
Member

horsdal commented Apr 25, 2015

On a quick first glance it doesn't seem related to #1862. It could be another issue in ConfigurableBootsttrapper though.

@PureKrome
Copy link
Contributor Author

👍 Ok, is this enough info for you @horsdal (or anyone else on the team), right now?

@khellang
Copy link
Member

@PureKrome I don't know how that method has ever worked. The method takes a params object[] dependencies, loops over them and calls this.Dependency<T>(dependency) where T is inferred to object 😕 I'll send a PR to fix it. In the meantime you should explicitly invoke the Dependencies<T> overload.

@PureKrome
Copy link
Contributor Author

where T is inferred to object

AH! I was hoping that was happening ... based on the error message :) Awesome!

Sweet as candy!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants