views:

45

answers:

2

I want to run some unittests. For this tests I need to use another value from the app.config file then the default value.

In this post "Reload app.config with nunit", I found a solution.

However when running multiple test at once, some test fail, because the old configuration file (app.config) is not called after disposing the function. How could this be ?

+6  A: 

Did you think of wrapping access to the configuration settings in a class? This way you could mock configuration settings in your tests either by using some mocking framework or by creating your own mocks.

Fredrik Mörk
+1 You beat me to it
PHeiberg
Thanks for the answer but this is not really a solution for my question. I dont't want to change my code just for testing purposes.
Jan
A: 

I did not found a good solution but for now I use another test project which uses a different app.config

Jan