z4kn4fein / stashbox-extensions-dependencyinjection

Stashbox Integration for ASP.NET Core, .NET Generic Host and ServiceCollection based applications.
https://z4kn4fein.github.io/stashbox
MIT License
17 stars 2 forks source link

Question: Is there a way to interact with the container from the StashboxServiceProvider #4

Closed vnvizitiu closed 5 years ago

vnvizitiu commented 5 years ago

Hello,

I was wondering if I can use the container methods (like WireUp and BuildUp), aside from Resolve when getting the StashboxServiceProvider via IServiceProvider.

Mostly interested in this for unit testing.

Thanks, Vlad V.

z4kn4fein commented 5 years ago

Hi,

The BuildUp is on the IDepenedencyResolver interface which can be requested from the IServiceProvider by calling the GetService(typeof(IDepenedencyResolver)).

If you want to use them in unit tests mostly you can check the tests of this sample app, it uses one of the Mocking extensions for Stashbox which allows accessing the underlying Stashbox container (for WireUp) and also can used for auto mocking.

Let me know if you have any more questions, or suggestions! Thanks!

vnvizitiu commented 5 years ago

Thank you for the clarification and the quick response.