Reputation: 25701
I am new to NUnit, but for time constraints on an old project, I am doing some quick integration tests. I have created a test database to test against, but how do I connect to it?
My NUnit project is a class library, and that can't have a web.config or app.config to pull the connection string from. Do I change it to a web project or some application project (it's just a class library now) or is there some why to connect to the database in the NUnit code?
Upvotes: 5
Views: 1695
Reputation: 11396
In fact your test project CAN have an app.config file. NUnit will load it correctly.
http://blog.coryfoy.com/2005/08/nunit-app-config-files-its-all-about-the-nunit-file/
This might also be useful: https://stackoverflow.com/a/5821939/1373170
Upvotes: 5