当我运行单元测试时,是什么导致 Cassini 加载
我有一个解决方案的测试项目,其中涉及 MVC Web 应用程序和几个类库。 我使用模拟对象和 System.Web.Abstractions 来避免对 ASP.NET 内部对象的依赖。 但是当我开始我的测试项目卡西尼号加载时。 如果我立即停止卡西尼号,我的所有测试仍然会通过。 那么为什么会加载呢? 并不是说加载有问题。 但如果我做的一切都是正确的,它似乎不应该加载。 那么,是什么导致它在我运行测试时加载呢?
该项目正在进行很多更改,而且我已经好几天没有直接处理它了,所以我不知道卡西尼号何时开始运行。
I have a test project for a solution which involves an MVC web application and several class libraries. I am using mock objects and System.Web.Abstractions to avoid dependencies on ASP.NET intrinsic objects. But when I start my test project Cassini loads. If I immediately stop cassini all my tests still pass. So why does it load? It's not that it's a problem that it's loading. But if I'm doing everything right it seems like it shouldn't load. So what causes it to load when I run my tests?
A lot of changes are being made to the project and I haven't been working on it directly for a few days so I don't know exactly when Cassini started running.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
听起来您的测试正在触及 System.Web.Abstractions 之外的东西。 您正在接触抽象程序集中的哪些类? 需要此信息来确定加载 Cassin 的原因。
It sounds like your tests are touching something outside of System.Web.Abstractions. What classes from the abstractions assembly are you touching? This information would be needed to determine why cassinin is loading.
我不做 asp.mvc 但似乎是一个常见的情况。
这是一个 wep 应用程序,不是吗? 打开项目属性,选择底部附近的“web”选项卡,选择“不要打开页面...”并取消选中 Debuggers:asp.net。
哈特哈,
天空
I don't do asp.mvc but seems a common scenario.
It is a wep app, no? Open project properties, select 'web' tab near bottom, select 'Don't open a page...' and UNcheck Debuggers:asp.net.
HTH,
Sky
实际上,我在运行单元测试项目时试图找到运行卡西尼的方法。 我可以通过设置对 Web 项目的显式项目依赖来做到这一点。
IE
右键单击单元测试项目> 项目依赖关系> 勾选网络项目。
对于你的情况,它可能会撤销这一点。 取消选中网络项目。
希望有帮助
I was actually trying to find ways to run cassini as I run my unit test project. I was able to do this by setting up explicit project dependency to the web project.
i.e
right click unit test project > project dependencies > tick web project.
For your case it could be undoing this. untick the web project.
Hope that helps
好的,所以我的问题的实际答案就在这里: 如何配置 VS2008 在具有多个项目的解决方案中仅打开一个 Web 服务器?
事实证明,您可以转到属性窗口(选择项目 -> F4 )并通过将“调试时始终启动”设置为“false”来关闭此功能。 最后,这一直很烦人,甚至当我的测试项目完全不依赖于 Web 项目时也会发生这种情况。
Ok, so the actual answer to my question is right here: How do you configure VS2008 to only open one webserver in a solution with multiple projects?
Turns out, that you can go to the properties window (select project -> F4) and turn this off by setting "Always Start When Debugging" to "false". Finally, this has always been so annoying and even happens when my test project has absolutely no dependencies on a web project.