views:

37

answers:

1

Hi I'm new to EF but am trying to go by the book and create tests for my repositories. The tests fails here.

desiner.cs base(global::System.Configuration.ConfigurationManager.ConnectionStrings["pij_localConnectionString"].ConnectionString, mappingSource)

I presume I need to move the connection strings out of the webconfig. What is the normal protocol/method for doing this?

+2  A: 

If you have created a unit test project and start testing from there then you just need to copy your connection string (pij_localConnectionString) to the app.config file of your test project. Basically any connection string data should be exist in the config file of the project that the .Net threads are initiated from by CLR (i.e. your startup project). You don't need to remove it from your web.config by the way.

Morteza Manavi
Yep, did that and it worked fine. Thanks.
Chin