title: The type initializer for 'System.Web.Mvc.ViewEngines' threw an exception
body: <p>I am trying to unit test a void method that have controllercontext parameter and some more to send email. Email template render partial view using view engine. I mocked controllercontext. So render view throw an exception because ControllerContext have null value.</p>
  
  <pre><code>public static string RenderViewToString(ControllerContext context, string viewPath, object model, bool partial = false)
          {
              var viewEngineResult = partial ? ViewEngines.Engines.FindPartialView(context, viewPath) : ViewEngines.Engines.FindView(context, viewPath, null);
  
              if (viewEngineResult == null)
                  throw new FileNotFoundException("View cannot be found.");
  
              var view = viewEngineResult.View;
              context.Controller.ViewData.Model = model;
  
              var result = String.Empty;
  
              using (var sw = new StringWriter())
              {
                  var ctx = new ViewContext(context, view,
                                              context.Controller.ViewData,
                                              context.Controller.TempData,
                                              sw);
                  view.Render(ctx, sw);
                  result = sw.ToString();
              }
  
              return result;
          }
  </code></pre>