Web.PublishedCache - move XML away from UmbracoContext

This commit is contained in:
Stephan
2013-03-19 17:54:41 -01:00
parent 3a0d617b14
commit b2a1f67fb4
5 changed files with 25 additions and 56 deletions

View File

@@ -1,3 +1,4 @@
using System;
using System.Linq;
using System.Xml;
using NUnit.Framework;
@@ -79,7 +80,8 @@ namespace Umbraco.Tests.PublishedCache
new PublishedContentCache(),
new PublishedMediaCache());
_umbracoContext.GetXmlDelegate = () =>
var cache = new PublishedContentCache();
cache.GetXmlDelegate = (user, preview) =>
{
var xDoc = new XmlDocument();
@@ -90,14 +92,18 @@ namespace Umbraco.Tests.PublishedCache
return xDoc;
};
_cache = new ContextualPublishedContentCache(new PublishedContentCache(), _umbracoContext);
_cache = new ContextualPublishedContentCache(cache, _umbracoContext);
}
private void SetupForLegacy()
{
Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = true;
_umbracoContext.GetXmlDelegate = () =>
{
var cache = PublishedContentCacheResolver.Current.PublishedContentCache as PublishedContentCache;
if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the legacy one is supported.");
cache.GetXmlDelegate = (user, preview) =>
{
var xDoc = new XmlDocument();
//create a custom xml structure to return