更新时间:2023-02-17 09:16:46
我以前遇到过这个问题,在阅读了所有我可以用google搜索的问题(包括该线程)之后,我就放弃了.
I've had this problem before and at that point gave up after reading all I could google about it (including this thread).
在我看来,该解决方案很简单.我要做的就是不使用ASP.NET测试属性,而只是将MVC项目作为DLL测试.
The solution turned out to be simple in my case. All I had to do was not use ASP.NET test attributes and simply test the MVC project as a DLL.
从测试中删除多余的属性.
Remove the extra attributes from the test.
[TestMethod]
public void TestMethod1()
{
Page page = TestContext.RequestedPage;
Assert.IsTrue(false, "Test ran, at least.");
}
在代码覆盖率"中,取消选中"MVC项目",然后手动添加MVC项目的DLL.
In Code Coverage, uncheck the MVC Project and add the MVC Project's DLL manually.
Voila,它是作为常规程序集进行检测的,没有错误,不会启动Development Server,也不会使团队构建失败.
Voila, it get instrumented as a normal assembly, no errors, doesn't spin up the Development Server, also doesn't fail the Team Build.