I have a test class . And inside this , i have a private class
class ControllerProxy : MarshalByRefObject
{
public IController CreateController()
{
}
}
Inside CreateController()
, I have created a Mock RequestContext (mockRequestContext
) and a Test Controller named "TestController"
However, on calling
var controller =
controllerFactory.CreateController(mockRequestContext.Object, "TestController");
I am getting an InvalidOperationException
:
"This method cannot be called during the application's pre-start initialization phase".
Please help.
Thanks in advance.