In running my VS2008 unit integration tests against my DAL, I have found that the assembly is reading machine.config
instead of the assembly's app.config
.
Here's the rundown on the call stack:
- Unit Test Project has method calling into a DataLayer Project
MyDataLayer
class inherits from a base class. Method is calledGetStuff()
- Base class is using
System.Configuration
. All good. - calling this property in code:
ConfigurationManager.ConnectionStrings["MyConnStr"]
actually returns null because it's not found apparently. - checking the
MyDataLayer
class, yep, MyConnStr is there. - checking the collection
ConnectionStrings
, yes, it has one connection string. It's the one in machine.config that's over inC:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\machine.config
- I am not sure why my DAL's
app.config
is being superseded by themachine.config
Any help is appreciated!