To run complex unit tests with a full dependency injection pattern, we provide a simple DependencyResolver.
using Juice.Extensions.DependencyInjection;
...
var resolver = new DependencyResolver
{
CurrentDirectory = AppContext.BaseDirectory
};
resolver.ConfigureServices(services =>
{
var configService = services.BuildServiceProvider().GetRequiredService<IConfigurationService>();
// IConfigurationRoot
var configuration = configService.GetConfiguration(args);
// configure options
// register services
});
// access IServiceProvider
var serviceProvider = resolver.ServiceProvider;
The library can be accessed via Nuget: