Print Page | Close Window

[SOLVED] How to Unit Test DevForce EF

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=790
Printed Date: 29-Oct-2020 at 2:02pm


Topic: [SOLVED] How to Unit Test DevForce EF
Posted By: philpastor
Subject: [SOLVED] How to Unit Test DevForce EF
Date Posted: 29-Apr-2008 at 12:31pm
ok, I've been struggling with this for a few hours now, and I give up.
 
I am attempting to create unit tests for the Domain Model in VS 2008. I have an app.config file in my test project, and the ideablade section is in there. When I run the test, Visual Studio's testing framework deploys the app config file as "TestProject1.dll.config" (which is expected), along with all of the ssdl, csdl, msl files. When I attempt to access the EntityManager, I get the following error:
 
Class Initialization method TestProject1.TestDevForce.MyClassInitialize threw exception. IdeaBlade.Util.v4.IdeaBladeException:  IdeaBlade.Util.v4.IdeaBladeException: Unable to obtain a valid configuration file on L3G1514.
Possible cause: No IdeaBladeSection in config file (File: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\CQConverter.exe.config)
Probing path:
1) File: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\CQConverter.exe.config - found but failed to load: No IdeaBladeSection in config file
2) File: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe.config - found but failed to load: No IdeaBladeSection in config file
3) File: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\diffmerge.exe.config - found but failed to load: No IdeaBladeSection in config file
4) File: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe.config - found but failed to load: No IdeaBladeSection in config file
5) File: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\TF.exe.config - found but failed to load: No IdeaBladeSection in config file
6) File: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\TfsBuild.exe.config - found but failed to load: No IdeaBladeSection in config file
7) File: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\TFSFieldMapping.exe.config - found but failed to load: No IdeaBladeSection in config file
8) File: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\vsdiag_regwcf.exe.config - found but failed to load: No IdeaBladeSection in config file
9) File: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VSSConverter.exe.config - found but failed to load: No IdeaBladeSection in config file
10) File: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VSTestHost.exe.config - found but failed to load: No IdeaBladeSection in config file
11) File: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VSTST-FileConverter.exe.config - found but failed to load: No IdeaBladeSection in config file
12) Design-time execution detected - Will not probe for app.config in AppHelper
13) app.config fallthru - Default app.config used
14) Logging file:
.
 
 
Any thoughts?



Replies:
Posted By: danielp37
Date Posted: 29-Apr-2008 at 10:00pm
I had the same problem and found the solution for me here: http://www.ideablade.com/forum/forum_posts.asp?TID=711 - http://www.ideablade.com/forum/forum_posts.asp?TID=711

I also found that I needed to add the csdl, msl and ssdl as additional files to deploy in the testrunconfig deployment.


Posted By: philpastor
Date Posted: 30-Apr-2008 at 5:26am
Daniel,
 
Thanks for the reply.
 
For anyone else looking for the solution, here is what I did:
Added a reference to IdeaBlade.Util.v4
Added a reference to System.Configuration
Added the following line to the ClassInitialize method of the test class:

IdeaBladeConfig.ConfigFileAssembly = System.Reflection.Assembly.Load("AppHelper");

...and yes, you also need to add the msl, csdl, ssdl files to the deployment tab of the testrunconfig.
 
Phil
 



Print Page | Close Window