How can I change a connection string, or other app settings, at test time in Visual Studio 2008?

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-04-26T18:12:00Z Indexed on 2010/04/26 18:13 UTC
Read the original article Hit count: 193

I need to test a class library project in VS. This project, itself, does not have a web.config file, but the classes do on the web server to which it's deployed. I access these like this:

ConfigurationManager.ConnectionStrings["stringname"].ConnectionString;

Can I adjust these strings while running unit tests in VS? Should I have considered a different design method to avoid this problem?

© Stack Overflow or respective owner

Related posts about visual-studio-2008

Related posts about unit-testing