C#C
C#3y ago
1 reply
kaypee90

Writing integration tests for .net core endpoints with authentication

I have built and endpoint using asp.net api controllers with the authorize attribute.
I am using the TestAuthHandler with a custom web app factory approach to test these endpoints but I still get unauthorized.

I realized HandleAuthenticateAsync method I have overriden in the TestAuthHandler is not being invoked.

This is a link to resource I was following https://gunnarpeipman.com/aspnet-core-integration-test-fake-user/
Kindly help me out.
Gunnar Peipman - Programming Blog
Creating fake users for ASP.NET Core integration tests by writing extension methods for web application factory and client.
Create fake user for ASP.NET Core integration tests
Was this page helpful?