是否有更强大的方法来集成测试我的持久层 app.config?
我的应用程序分为以下项目/程序集
- Approot/UI
- AppDomain/业务逻辑/层
- 域.测试
- 持久化/数据库层
- 持久性测试
我正在使用 MSTest 对存储在 Persistance 程序集中的连接字符串进行集成测试。目前我正在使用 LocalTestRun.config 作为解决方案,告诉它包含持久层的 app.config 文件进行测试,但我想如果任何其他层在其测试部分中有 app.config 文件,这将无法正常工作。这应该如何设置? ConfigurationManager.GetSection(程序集名称?)
。
添加 [DeploymentItem("app.config")] 对测试方法有什么作用?
[TestMethod]
[DeploymentItem("app.config")] // I added this to see if it would help somehow
public void Configuration_ConnectionStrings_Connect()
{
//code omitted
}
I have my application broken into the following projects/assemblies
- Approot/UI
- AppDomain/business logic/layer
- Domain.Tests
- Persistance/db layer
- Persistance.Tests
I'm integration testing the connection string stored in the Persistance assembly using MSTest. currently I am using LocalTestRun.config for the solution to tell it to include the Persistance layer's app.config file for testing, but I imagine this will not work well if any other layers have an app.config file in their test sections. How is this supposed to be set up? ConfigurationManager.GetSection(assemblyName?)
.
What does adding [DeploymentItem("app.config")] do for the test method?
[TestMethod]
[DeploymentItem("app.config")] // I added this to see if it would help somehow
public void Configuration_ConnectionStrings_Connect()
{
//code omitted
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论