AI OnAI Off
If I write:
PageReference pr = PageReference.StartPage;
PageData startPage = DataFactory.Instance.GetPage(pr)
I get:
"System.ApplicationException: First time you call Settings.Instance you must have a valid HttpContext."
I found it here but cannot see how it will help?
http://marekblotny.blogspot.se/2009/03/tdd-with-episerver.html
Ok so I am all new to unit testing and trying to get it to work with CMS 5 R2. I have searched all over but can't quite get the hang of it. In my test class I am making a new object of a class that is trying to access some properties on the startpage. To do it I am calling DataFactory.Instance.GetPage(PageReference.StartPage)
When I run the test I get a:
System.TypeInitializationException: The type initializer for 'EPiServer.DataFactory' threw an exception.
InnerException: {"The application relative virtual path '~/' is not allowed here."}
Is there any way I can access the start page either from my code or if I access the pagedata from the test code and then send the pagedata to my class?