You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Per the motivation for this API change originally: #4814
I propose a change to the ServiceProvider where instead of passing in an IServiceProvider we instead pass in a IDependencyResolver interface, by default this IDependencyResolver will be a SeriveProviderDependencyResolver that uses the IServiceProvider to resolve any DI dependencies. This will allow others to create their own implementations of the IDependencyResolver for testing.
I now find myself in the position of having this very use case as I write some integration tests for our upcoming Akka.Cluster.Sharding persistence repair tool and I need to be able to inject some lightweight dependencies into an actor that also needs to be created using DependencyResolver.Props.
I wonder - would it be worthwhile to include a built-in implementation of the IDependencyResolver for the explicit use case of testing only?
This class wouldn't really be part of the public API even though it would be a public class.
Describe the solution you'd like
A builder-style pattern for being able to quickly compose a lightweight IDependencyResolver that is fully decoupled from Microsoft.Extensions.DependencyInjection.
Describe alternatives you've considered
Just mocking up and using the IServiceProvider inside my unit tests anyway.
Additional context
I'm looking for feedback from other users who have similar use cases and might be interested.
The text was updated successfully, but these errors were encountered:
The Akka.Hosting.TestKit, which uses a real IServiceCollection instead of a fake or a mock, ended up being the right solution to this problem: https://github.com/akkadotnet/Akka.Hosting
Is your feature request related to a problem? Please describe.
Per the motivation for this API change originally: #4814
I now find myself in the position of having this very use case as I write some integration tests for our upcoming Akka.Cluster.Sharding persistence repair tool and I need to be able to inject some lightweight dependencies into an actor that also needs to be created using
DependencyResolver.Props
.I wonder - would it be worthwhile to include a built-in implementation of the
IDependencyResolver
for the explicit use case of testing only?This class wouldn't really be part of the public API even though it would be a
public
class.Describe the solution you'd like
A builder-style pattern for being able to quickly compose a lightweight
IDependencyResolver
that is fully decoupled fromMicrosoft.Extensions.DependencyInjection
.Describe alternatives you've considered
Just mocking up and using the
IServiceProvider
inside my unit tests anyway.Additional context
I'm looking for feedback from other users who have similar use cases and might be interested.
The text was updated successfully, but these errors were encountered: