DEV Community

Discussion on: ASP.NET Core Integration Testing: Protected endpoints

Collapse
lazlobodi profile image
László Bódi

Hi,

I'd like to mock the cookie that the

awat Request.HttpContext.SignInAsync("Cookies", claimsPrincipal);

gives back, in order to test the endpoints protected with the Authorize attribute. I don't want to call the login endpoint just before every test scenario to have a valid cookie, just want to mock it.
How can I achieve it?
Thank in advance.