我的 mvc 应用程序的项目 url 像这样托管 localhost:port/AppName
我创建了一个新的单元测试项目来测试 mvc 应用程序使用 nunit 框架和批准测试我使用了 Approval Tests Library
[Test]
[UseReporter(typeof(FileLauncherReporter),typeof(ClipboardReporter))]
public void PaymentPopUpController_IndexView()
{
//Arrange
PortFactory.MvcPort = 8080;
// Act
Func<ActionResult> ScopeControllerTest = new ScopeController()._Index;
// Approve
MvcApprovals.VerifyMvcPage(ScopeControllerTest);
}
MvcApprovals.VerifyMvcPage 抛出一个错误,说它找不到 url,因为我没有设置正确的项目 url:
连接到时出现以下错误:
http://localhost:8080/Scope/_index
错误:
远程服务器返回错误:(404) Not Found。
所以我的问题是如何设置正确的 url 来设置 nunit 进行 mvc 批准测试