I have an NUnit test project that is testing a Console App project. The Console app project uses the app.config file heavily. When running tests from my NUnit test project, the code being tested uses the config values in my Tests.dll.config file. This file is located in my Test project's root directory and is a copy of the app.config file from the app being tested.
However, in some tests I need to change the value of some of the config settings. I have been using this in my Nunit test to do it:
ConfigurationManager.AppSettings.Set("SettingKey" , "SettingValue");
I don't want these runtime config changes I make in one test to interfere or be seen by any other tests. Is this the correct way to do it?
UPDATE I should also mention that my tests run in parallel. I think this is because I am using Re-sharper. So if I change the config in one test I think it may change the config in another test, which I don't want.