I am using AspnetMvc4. A moment ago I wrote
ConfigurationManager.AppSettings["mykey"] = "myvalue";
in my test method and it worked perfectly.
Explanation: the test method runs in a context with app settings taken from, typically a web.config
or myapp.config
. ConfigurationsManager
can reach this application-global object and manipulate it.
Though: If you have a test runner running tests in parallel this is not a good idea.