I am trying to unit test a view and validate HTML that is rendered that has a Layout specified, but nothing gets rendered. If I remove layout it works fine. Here is a sample of my view. What I want to validate is the HTML in the LeftPane.
Layout = "~/Views/Shared/_TwoPaneLayout.cshtml";
<link href="@Url.Content("~/Content/css/smb-error.css?" + @Model.BuildNumber)" rel="stylesheet" type="text/css" />
Here is my unit test code.
var view = new Portal.Views.Shared.Error();
ErrorModel model = new ErrorModel();
model.Exception = new Exception("Unit test");
// unknown error
model.Type = ErrorModel.ErrorType.Unknown;
HtmlDocument doc = view.RenderAsHtml<ErrorModel>(model);
For this my HtmlDocument comes back with just a couple of \r\n and no Html.