5

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?

cdub
  • 24,555
  • 57
  • 174
  • 303

1 Answers1

5

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

Community
  • 1
  • 1
Pablo Romeo
  • 11,298
  • 2
  • 30
  • 58