Class ServiceProviderContainer
- Assembly
- Mokkit.Containers.Microsoft.Extensions.DependencyInjection.dll
Represents a dependency injection container that wraps Microsoft.Extensions.DependencyInjection's IServiceProvider. This container integrates with the Mokkit testing framework to provide scoped service resolution using the Microsoft DI container.
public class ServiceProviderContainer : BaseDependencyContainer, IDependencyContainerInheritance
Implements
Inherited Members
Constructors
ServiceProviderContainer(IServiceProvider)
Initializes a new instance of the Mokkit.Containers.Microsoft.Extensions.DependencyInjection.ServiceProviderContainer class with the specified service provider.
public ServiceProviderContainer(IServiceProvider serviceProvider)Parameters
serviceProviderIServiceProvider-
The service provider to wrap for dependency injection.
Methods
BeginScope(TestHostContext)
Creates a new dependency injection scope within the specified test host context. The scope provides isolated service resolution using Microsoft.Extensions.DependencyInjection scoping.
public IDependencyContainerScope BeginScope(TestHostContext context)Parameters
contextTestHostContext-
The test host context that defines the scope parameters.
Returns
- IDependencyContainerScope
-
A new Mokkit.Containers.IDependencyContainerScope for scoped service resolution.