Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

How to setup Integration Test Project that gets StructureMap to load properly

$
0
0

I have added a test project, and I want to test creating pages programtically.  Since the Test Project is the Entry Point, I keep getting this error:

An exception of type 'StructureMap.StructureMapConfigurationException' occurred in StructureMap.dll but was not handled in user code

Additional information: No default Instance is registered and cannot be automatically determined for type 'EPiServer.IContentRepository'

I am referening this article

Create Page Programaticallyhttp://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/Content/Creating-a-page-programmatically/

to create pages, but cannot figure out how to get StuctureMap to load it's configuration in a Unit Test Project.

The error happens on this line:

IContentRepository contentRepository = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<IContentRepository>();

I have searched and looked at StructureMap's site, but I don't find that useful.

Someone out here has to have created an integration test project to test functionality.  Basically I know the Structure Map configuration needs to be loaded by the test project, but I cannot figure out how do that.

Thanks,

-Bernie


Viewing all articles
Browse latest Browse all 9076

Trending Articles