I have a bit of a problem using the Sitecore SiteInfo object. This object contains details about a site, such as database name, site name and hostname, and can be used to create a SiteContext object. My problem is in setting the RootPath. The only documentation I can find for this is for an older API version, and contains no details. As far as I can find, this is the way to create a SiteInfo and its SiteContext:
SiteInfo mySiteInfo = SiteInfo.Create(new StringDictionary { {"rootpath", "/sitecore/content"}, {"name", "mySite"}, {"foo", "bar"} });
SiteContext mySiteContext = new SiteContext(mySiteInfo);
Running this line gives no errors, but mySiteInfo.RootPath is still empty, even though mySiteInfo.Name has the value mySite. {"foo", "bar"} seems to be completely ignored, but that's no problem. Am I trying something Sitecore does not support?
Some more background: I'm trying to create a fake SiteContext using Sitecore.FakeDB, per the guide listed here, for use in my unit-tests. I need to set the RootPath, for testing my code.
Aucun commentaire:
Enregistrer un commentaire