3

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.

Sergey Berezovskiy
  • 232,247
  • 41
  • 429
  • 459
DfrDkn
  • 1,270
  • 2
  • 16
  • 23

0 Answers0