tags:

views:

33

answers:

0

We have an MVC web which is running in Autofac. All the config is stored in an autofac config section in the web.config and when run the Global asax sets up the container and sorts out all the modules by providing them with their config settings - the one I'm interested in at the moment is the NHibernate module - so this gets the connection string set into its constructor.

I want to build some tests to test Data Access with NHibernate - we've got repositories and a service layer but this isn't necessarily relevant.

Should I be adding an extra project to the Solution with all my tests in and if I do this do I need to replicate the database connection string in an autofac config for this test project and build a test container in this project which will test my data access? Or should I be trying to get hold of the web app's container to do the testing with - I assume not as the Global.asax's Application_start will not run unless hit by an http GET. I don't really want to replicate all the config and container creation of the web app but at the moment I'm thinking I will have to...?