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.
我正在测试一些业务对象的Save()方法。为了保存对象,我需要从Configuration Manager读取连接字符串。但我得到的只是空值。我的设置在web站点web.config中。如何在测试运行时获取。我需要其他配置吗?
1 个解决方案
#1
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.
单元测试项目必须拥有自己的配置文件。在项目中添加一个,并在其中放置所需的连接字符串设置。
#1
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.
单元测试项目必须拥有自己的配置文件。在项目中添加一个,并在其中放置所需的连接字符串设置。