Last week I gave a presentation at Microsoft DevDays 2004 in Lisbon on Test-Driven Development. A day later I got this interesting question:
"(...) if I'm testing a DLL assembly that uses a .config file to read in data, when I run the tests, NUnit loads it's own .config file and all my tests fail. How can I solve this ?"
I also had this same problem a while back. There are two separate answers to this question as far as I could tell:
- If we're using the NUnit GUI than it's just a question to specify which .config file to load (Project -> Edit)
- If we're running NUnit from the console, copy the config file to the directory where the test assembly is located (tipically bin\Debug) and rename the config file to <test assembly>.config (ex: UniTests.dll.config)
This will cause NUnit to load the required .config file.