Last active
February 24, 2018 09:41
-
-
Save Ibro/79e6bd4cb7c224f86c2fe5059de5d654 to your computer and use it in GitHub Desktop.
BuildAuthorizationService - ASP.NET Core - Unit Testing Authorization Service - https://codingblast.com/asp-net-core-unit-testing-authorizationservice-inside-controller/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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