Sam*_*Sam 3 unit-testing xunit asp.net-core
我使用Microsoft.AspNet.TestHost来托管xunit集成测试.只要测试与asp.net-5解决方案在同一个项目中,一切都可以正常工作.
但我想将测试放入一个单独的程序集中,以便将它们与解决方案分开.但是当我尝试在单独的解决方案中运行测试时出现错误,TestServer无法找到视图.
Bsoft.Buchhaltung.Tests.LoginTests.SomeTest [FAIL]
System.InvalidOperationException : The view 'About' was not found. The following locations were searched:
/Views/Home/About.cshtml
/Views/Shared/About.cshtml.
Run Code Online (Sandbox Code Playgroud)
我猜TestServer相对于本地目录查看视图.我怎样才能让它看到正确的项目路径呢?
我在这里有一个样本回购 - https://github.com/mattridgway/ASPNET5-MVC6-Integration-显示修复的测试(感谢David Fowler).
TL; DR - 设置TestServer时,需要设置应用程序基本路径以查看其他项目,以便查找视图.
归档时间: |
|
查看次数: |
894 次 |
最近记录: |