How to change the connection string or other application settings during testing in Visual Studio 2008?

I need to test the class library project in VS. This project itself does not have a web.config file, but classes are done on the web server on which it is deployed. I refer to them as follows:

ConfigurationManager.ConnectionStrings["stringname"].ConnectionString;

Can I customize these lines while running unit tests in VS? Should I consider a different design method to avoid this problem?

+3
source share
1 answer

You can put the configuration in the app.config of the unit test project.

+2
source

Source: https://habr.com/ru/post/1742871/


All Articles