Is it possible to pass something in to Cassini-dev running an MVC3 app that could be used to override a component in the app's IoC configuration
I am writing an MCV3 application using Windsor as the IoC container. I am using Cassini-dev and WaitN in the Acceptance tests and have a number of basic tests which work fine.
What I normally do in my acceptance testing is fire up a new database with a unique name, populate it with some data, run the test and then through the database away.
In order to do this I need to provide开发者_运维技巧 my MVC3 application the new database connection string which is wired up to a configuration object passed into Windsor.
Additionally I will need to mock out a couple of components that do not exist in my testing environment and need to pass those into Windsor instead or the real objects.
If anyone has done this or something similar I would be interested to hear about your experience.
Cassini is merely a web server and ASP.NET host, it has nothing to do with this. But you could use web.config transformations to select different configurations depending on environment. Here's an example that shows how to change connection strings.
精彩评论