You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm new to Hot Chocolate and am currently trying it out for the first time. This topic was kind of touched on elsewhere in a response but I'm afraid I didn't understand it, so I thought I'd ask explicitly.
I'm trying to write an Xunit test for a query class that takes a ClaimsPrincipal as part of a resolver:
public ResponseModel BookingsByParentId(Guid parentId, ClaimsPrincipal claimsPrincipal)
How can I setup the claims for the unit test, so that I can get the test to run, given that I don't have a controller context to mock?
At the moment I get a Hot Chocolate exception on the ClaimsPrincipal not being setup:
Unexpected Execution Error Exception = {"Could not resolve the claims principal. (Parameter 'context')"}
If possible can you show me some example code as part of the response, thank you :)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I'm new to Hot Chocolate and am currently trying it out for the first time. This topic was kind of touched on elsewhere in a response but I'm afraid I didn't understand it, so I thought I'd ask explicitly.
I'm trying to write an Xunit test for a query class that takes a ClaimsPrincipal as part of a resolver:
public ResponseModel BookingsByParentId(Guid parentId, ClaimsPrincipal claimsPrincipal)
How can I setup the claims for the unit test, so that I can get the test to run, given that I don't have a controller context to mock?
At the moment I get a Hot Chocolate exception on the ClaimsPrincipal not being setup:
Unexpected Execution Error
Exception = {"Could not resolve the claims principal. (Parameter 'context')"}
If possible can you show me some example code as part of the response, thank you :)
Beta Was this translation helpful? Give feedback.
All reactions