What causes Cassini to load when I run a unit test [duplicate]

微笑、不失礼 提交于 2019-12-12 18:26:55

问题


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.


回答1:


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.




回答2:


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




回答3:


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




回答4:


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.



来源:https://stackoverflow.com/questions/533412/what-causes-cassini-to-load-when-i-run-a-unit-test

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!