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


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 Programatically

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();

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.



Jan 30, 2016 19:32


I think that this blog post describe solution for your problem:

Feb 01, 2016 10:01

I don't want to MOCK..   I want to do Integration tests, which means no mocking, actual objects are needed for that.

Feb 01, 2016 13:16

This repo should help understand how to run integration test

Feb 08, 2016 11:30
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.