????5????Web????????????????
using System;
using System.Linq;
using System.Web.Mvc;
using HtmlAgilityPack;
using NUnit.Framework;
using RazorGenerator.Testing;
namespace WebApplication1.Tests.Views.Shared
{
[TestFixture]
public class ErrorTest1
{
[Test]
public void TestMethod1()
{
AssertHtml<ASP._Views_Shared_Error_cshtml?? HandleErrorInfo>("content"??
@"<h1 class=""text-danger"">Error.</h1>
<h2 class=""text-danger"">An error occurred while processing your request.</h2>");
}
public static HtmlDocument Render<TView??TModel>()
where TView : WebViewPage<TModel>?? new()
{
TView view1 = new TView();
WebViewPage<TModel> view = view1 as WebViewPage<TModel>;
HtmlDocument doc = view.RenderAsHtml();
Assert.IsEmpty(doc.ParseErrors.Where(x => x.Code != HtmlParseErrorCode.EndTagNotRequired));
return doc;
}
public static void AssertHtml<TView?? TModel>(string containerId?? string expected?? bool collapsed = false)
where TView : WebViewPage<TModel>?? new()
{
HtmlDocument doc = Render<TView??TModel>();
expected = expected.Replace(" "?? " ");
string actual =  doc.GetElementbyId(containerId).InnerHtml.Trim().Replace(" "?? " ");
Assert.AreEqual(expected?? actual);
}
}
}
????6?????в?????????????