I'm trying to add a test that validates that all the MVC controllers in my project can resolve successfully. I get them with
MvcControlleractionlist = asm.GetTypes()
.Where(type => typeof (System.Web.Mvc.Controller).IsAssignableFrom(type));
In the test I try to resolve them with:
foreach (var mvcController in MvcControlleractionlist)
{
Container.Resolve(mvcController);
}
The error I get is this:
InnerException = {"The PerRequestLifetimeManager can only be used in the context of an HTTP request. Possible causes for this error are using the lifetime manager on a non-ASP.NET application, or using it in a thread that is not associated with the appropriate synchronizati...
I assume MVC in the background registers all the controllers with the PerRequestLifetimeManager. How can I make MVC think the test is running within an HTTP request?