title: Unit tests that depend on a real instance of IRazorViewEngine
body: <p>I need to render a view to a string (to send as email). I'm using <a href="https://stackoverflow.com/a/39400153/7059613">this implementation</a>.</p>
  
  <p>I want to unit test it, without needing a full ASP.NET Core environment. So I must create an instance of <code>IRazorViewEngine</code>.</p>
  
  <p>The default implementation is <code>RazorViewEngine</code>. <a href="https://docs.microsoft.com/en-us/aspnet/core/api/microsoft.aspnetcore.mvc.razor.razorviewengine#Microsoft_AspNetCore_Mvc_Razor_RazorViewEngine__ctor_Microsoft_AspNetCore_Mvc_Razor_IRazorPageFactoryProvider_Microsoft_AspNetCore_Mvc_Razor_IRazorPageActivator_System_Text_Encodings_Web_HtmlEncoder_Microsoft_Extensions_Options_IOptions_Microsoft_AspNetCore_Mvc_Razor_RazorViewEngineOptions__Microsoft_Extensions_Logging_ILoggerFactory_" rel="nofollow noreferrer">I has a mega constructor</a> because each argument needs to be created and each one has a mega constructor, etc., etc. (I can't mock it, I need a live instance.)</p>
  
  <p>Surely there is a simpler way to get an instance?</p>
  
  <p>(Before Core, I could use <code>ViewEngines.Engines</code>. Maybe Core has something similar?)</p>