Instantly share code, notes, and snippets.

Embed
What would you like to do?
BuildAuthorizationService - ASP.NET Core - Unit Testing Authorization Service - https://codingblast.com/asp-net-core-unit-testing-authorizationservice-inside-controller/
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