问题
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