The question has been Updated for better explanation to the issue I have,
Simply I have this controller,
[Authorize]
publi
I encountered this issue as well while developing an ASP.NET Core API. My situation was less complex, so not sure if the same solutions is applicable for you.
Here is my solution
IAuthorizationService has two methods that are not extensions. One can assume (and I verified) that the extensions are just helpers and will call either one of these methods.
Task AuthorizeAsync(ClaimsPrincipal user, object resource, IEnumerable requirements);
Task AuthorizeAsync(ClaimsPrincipal user, object resource, string policyName);
So mocking IAuthorizationService for me was as simple as doing the following:
var authorizeService = new Mock();
authorizeService.Setup(service => service.AuthorizeAsync(It.IsAny(), It.IsAny