I’m trying to run unit tests for a project which is reliant on the web instance as it uses integrated windows authentication to verify the current user. When I run the tests it doesn’t fire up the web instance, which is expected, but I need it to in order for any tests to succeed really. Anyone have any idea of how to do this?
Share
Okay, I got this working in the end. You have to mock
HttpContextBase(which is preferential overHttpContextI hear) and then set up yourIPrincipalwhich is returned from the mock object. I’ll give the full code listing so you get the idea: