Skip to content

Unit testing RouteClaimsRequirement #2068

Answered by raman-m
aleroca96 asked this question in Q&A
Discussion options

You must be logged in to vote

I believe you need to mock injected services of the ClaimsAuthorizer class 👇

private readonly IClaimsParser _claimsParser;
public ClaimsAuthorizer(IClaimsParser claimsParser)
{
_claimsParser = claimsParser;
}

So, you have to mock IClaimsParser interface object, and/or IClaimsAuthorizer object.
But exact mocking depends on the unit test and testing scenario.

Anything else?

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@aleroca96
Comment options

@raman-m
Comment options

Answer selected by raman-m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Authorization Ocelot feature: Authorization
2 participants