Create fake user for ASP.NET Core controller tests

added by DotNetKicks
1/13/2020 4:32:13 PM

301 Views

I think most of ASP.NET Core applications have authentication enabled. When writing unit tests for controllers we have one set of tests that need authenticated user and other set of tests that need anonymous user. Faking User property of controller is a little bit tricky. This blog post shows how to do it.


0 comments