I have a solution divided into two projects, one for a Class Library and another one for Unit Tests (using NUnit 2.5). Now, on the App.config file of the Class Library project I added several lines like
<add key="KeyName" value="KeyValue"/>
which I am reading in the class library code with
ConfigurationManager.AppSettings["KeyName"].
The problem is that when I run the unit tests the class library can't access those values because even though that code is used from within the library, it goes looking for them in the App.config of the Unit Tests project. If I add those line to this file everything goes smooth, but that's of course not what I want. How can I tell ConfigurationManager to look for the keys in the right application path?
use ConfigurationManager.OpenExeConfiguration("file path") to open correct path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With