How to load web.config while using MS Test
-
06-07-2019 - |
Question
I am testing some business object's Save() method. In order to save object, I need to read connection string from Configuration Manager. But all I get is null value. My settings are in web site web.config. How can I obtain during test runtime. Do I need additional configuration.
Solution
The unit test project has to have it's own config file. Add one to the project and place the connection string settings you need in it.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow