Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
BuildAuthorizationService - ASP.NET Core - Unit Testing Authorization Service
private IAuthorizationService BuildAuthorizationService(Action<IServiceCollection> setupServices = null)
{
var services = new ServiceCollection();
services.AddAuthorization();
services.AddLogging();
services.AddOptions();
setupServices?.Invoke(services);
return services.BuildServiceProvider().GetRequiredService<IAuthorizationService>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment