title: Get View Name where ViewResult.ViewName is empty string for Unit Testing
body: <p>I have written an extension method on ActionResult for use in unit testing which will assert whether the ViewName returned is what was expected.  This is the code I have so far:</p>
  
  <pre><code>public static void AssertViewWasReturned(this ActionResult result, string viewName)
  {
      string actualViewName;
  
      if (result is ViewResult)
          actualViewName = (result as ViewResult).ViewName;
      else if (result is PartialViewResult)
          actualViewName = (result as PartialViewResult).ViewName;
      else
          throw new InvalidOperationException("Results of type " + result.GetType() + " don't have a ViewName");
  
      Assert.AreEqual(viewName, actualViewName, string.Format("Expected a View named{0}, got a View named {1}", viewName, actualViewName));
  }
  </code></pre>
  
  <p>This works fine except where the controller returns a View without specifying a name - in this case <code>result.ViewName</code> is an empty string.</p>
  
  <p>So, my question is - is there any well of telling from a ViewResult object what the name of the View was where ViewName is an empty string?</p>