Moles v0.94 Causing Tests To Ignore Config File
Asked Answered
K

1

0

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.

Knowland answered 14/1, 2012 at 0:35 Comment(1)
What type of project is this? (ASP.NET, C# Library, etc.) I assume you are attempting to access the settings of the target assembly, and not the test project.Lita
K
0

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

Knowland answered 19/1, 2012 at 15:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.