Moles v0.94 导致测试忽略配置文件

发布于 2024-12-26 12:38:02 字数 394 浏览 0 评论 0原文

我使用 Moles v0.91 至少一年了,每天编写和执行数百个测试。升级到 v0.94 后,在 Moles 主机下运行的测试不再能够访问配置文件。这些测试在几天前都运行良好。每个测试的错误消息清楚地表明它们无法访问配置,例如查找连接字符串。 (是的,我知道好的单元测试不应该访问数据库。请不要关注这一点)。

在同一个项目中,访问配置但不在 Moles 主机下运行的测试运行良好。

对于如何解决这个问题有什么建议吗?出现在具有当前服务包的 Visual Studio 2008 和 2010 中以及 .Net 3.5 和 .Net 4.0 下。

更多详细信息:这是一个测试项目,其中包含可在同一项目中正确读取的 app.config,用于不运行 Moles 主机的测试。使用企业库进行数据库和日志记录,两者都无法读取配置文件。

I've been using Moles v0.91 for at least a year, with hundreds of tests written and executed daily. After upgrading to v0.94, tests that run under the Moles host are no longer able to access the config file. These are tests that were otherwise working fine a few days earlier. The error message for each of these tests plainly indicates that they were unable to access the config, for example to find a connection string. (Yes, I know good unit tests should not be accessing the database. Please do not focus on that).

In the same project, tests that access the config but do not run under the Moles host are working perfectly.

Any suggestions for how to resolve this? Occurs in both Visual Studio 2008 and 2010, with current service packs and under both .Net 3.5 and .Net 4.0.

MORE DETAIL: This is a Test project with an app.config that is properly read, in the same project, for tests that do not run the Moles host. Using Enterprise Library for database and logging, both of which are failing to read the config file.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红玫瑰 2025-01-02 12:38:02

看来我忽略了 MDSN 论坛帖子从 2010 年开始,这被认为是一个错误。而且似乎没有人急于修复它。因此,是时候通过更多的抽象、仔细的重构和更符合理论的“单元”测试(即用更多的 Moles 来解决问题)来将其转化为进一步改进代码的机会。

It seems that I overlooked an MDSN forum post from 2010 where this was acknowledged as a bug. And it seems that no one is in a hurry to fix it. Thus, time to turn this into an opportunity to further improve the code through a little more abstraction, some careful refactoring, and more true-to-theory "unit" tests (that is, fix the problem with even more Moles).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文