NUnit tip for ConfigurationSetings.AppSettings
Today I had to unit test a dll that will read the web.config file from my web app. Here is the setup
MyUnitTester
TestSettings (Tests GetSettingsFromKey)
MyBusinessObject
GetSettingsFromKey
I never had to do this before so I read the NUnit PDF and it actually turned out to be quite simple.
- Copy the web.config file that you will read into the bin\debug directory of the test project.
- Look for a file with the .nunit extension (should be the same name as the test project's dll)
- Rename the web.config file to the same name as the nunit file but change .nunit to .config.
- Run your tests.