How can I unit test my ASP.NET MVC controller that uses FormsAuthentication?
Unit Testing ASP.Net MVC 4 apps thoroughly
- Making sure a view exists
- see below
- How can I unit test my ASP.NET MVC controller that uses FormsAuthentication?
- How-to test action filters in ASP.NET MVC?
I'm working with a ASP.NET MVC solution in a test driven manner and I want to login a user to my application using forms authentication. The code I would like to end up with in the controller looks something like this:
My question is how do I write a test to justify this code?
Is there a way to check that the SetAuthCookie method was called with the correct parameters?
Is there any way of injecting a fake/mock FormsAuthentication?