in tests you can assign a value to EPiServer.Web.SiteDefinition.Current (ContentReference.StartPage is resolved from SiteDefinition.Current)
Here is my solution to this. Thanks Johan!
SiteDefinition.Current = new SiteDefinition()
StartPage = new PageReference(4)
In EPiServer 7.0 and 7.1 I set the ContentReference.StartPage = new PageReference(4). In 7.5 this is not possible because ContentReference.StartPage is not writeable. (Invalid use of read-only object, call CreateWritableClone() to create a writable clone.)
The reason I want to set ContentReference.StartPage is that the property is used in some code to be tested. E.g. page.CompareToIgnoreWorkPageId(ContentReference.StartPage)
Does anyone have a solution to this?