Moles v0.94 Causing Tests To Ignore Config File

我怕爱的太早我们不能终老 提交于 2019-12-11 16:11:34

问题


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.


回答1:


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).



来源:https://stackoverflow.com/questions/8859087/moles-v0-94-causing-tests-to-ignore-config-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!