November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
You can take a deeper look at EPiServer.Global class (from which your Global.asax.cs is inherited in EPi web project). There is a pretty heavy initialization procedure. I would start with EPiServer.Global type constructor to understand further call chain.
You would also need to copy over few configuration files to properly initialize CMS context (part of the web.config file, episerver*.config, connectionStrings.config).
A good starting point would be: http://tedgustaf.com/sv/blogg/2010/8/unit-test-an-episerver-6-website-using-visual-studio-2010-and-mstest/
Hi,
I have a Visual Studio solution that looks like this:
Solution
- EPi web project
- test1.aspx
- Web service web project
- test2.aspx
- Class library project
- class1.cs
- GetChildPages(int parentId)
The web projects are released on different domains and they both use logic in the class library.
The method looks like this:
GetChildPages(int parentId)
{
PageData pd = EPiServer.DataFactory.Instance.GetPage(new PageReference(parentId));
//todo: loop pd children...
}
Calling GetChildPages(int parentId) in test1.aspx works fine.
Calling GetChildPages(int parentId) in test2.aspx results in this exception:
DataFactory.Instance = 'DataFactory.Instance' threw an exception of type 'System.TypeInitializationException'
My guess is that I get this error because test2.aspx is not located in a EPi web project (with all EPi settings etc).
How can I make it possible to call the class library method from test2.aspx (a normal Visual Studio web project)?