Merge branch '6.2.0-pubcontent' into 7.0.0-pubcontent
Conflicts: src/Umbraco.Core/Cache/CacheProviderBase.cs src/Umbraco.Core/Cache/HttpRuntimeCacheProvider.cs src/Umbraco.Core/Cache/NullCacheProvider.cs src/Umbraco.Core/Cache/StaticCacheProvider.cs src/Umbraco.Core/Configuration/UmbracoSettings.cs src/Umbraco.Core/CoreBootManager.cs src/Umbraco.Core/Dynamics/PropertyResult.cs src/Umbraco.Core/Models/IPublishedContentProperty.cs src/Umbraco.Core/Models/PublishedItemType.cs src/Umbraco.Core/PropertyEditors/IPropertyEditorValueConverter.cs src/Umbraco.Core/PropertyEditors/PropertyEditorValueConvertersResolver.cs src/Umbraco.Core/PropertyEditors/PropertyValueConvertersResolver.cs src/Umbraco.Core/PublishedContentExtensions.cs src/Umbraco.Core/PublishedContentHelper.cs src/Umbraco.Core/Umbraco.Core.csproj src/Umbraco.Tests/CodeFirst/StronglyTypedMapperTest.cs src/Umbraco.Tests/LibraryTests.cs src/Umbraco.Tests/PropertyEditors/PropertyEditorValueConverterTests.cs src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs src/Umbraco.Web/ExamineExtensions.cs src/Umbraco.Web/Models/DynamicPublishedContent.cs src/Umbraco.Web/Models/XmlPublishedContent.cs src/Umbraco.Web/Models/XmlPublishedContentProperty.cs src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs src/Umbraco.Web/PublishedContentExtensions.cs src/Umbraco.Web/Templates/TemplateUtilities.cs src/Umbraco.Web/Umbraco.Web.csproj src/Umbraco.Web/WebBootManager.cs src/Umbraco.Web/umbraco.presentation/macro.cs src/umbraco.MacroEngines/RazorDynamicNode/PropertyResult.cs src/umbraco.MacroEngines/RazorDynamicNode/PublishedContentExtensions.cs
This commit is contained in:
@@ -4,6 +4,9 @@ using System.Xml;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
@@ -14,11 +17,12 @@ using umbraco.BusinessLogic;
|
||||
namespace Umbraco.Tests.PublishedCache
|
||||
{
|
||||
[TestFixture]
|
||||
public class PublishContentCacheTests
|
||||
public class PublishContentCacheTests : BaseWebTest
|
||||
{
|
||||
private FakeHttpContextFactory _httpContextFactory;
|
||||
private UmbracoContext _umbracoContext;
|
||||
private ContextualPublishedContentCache _cache;
|
||||
private XmlDocument _xml;
|
||||
|
||||
private string GetLegacyXml()
|
||||
{
|
||||
@@ -66,30 +70,23 @@ namespace Umbraco.Tests.PublishedCache
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
TestHelper.SetupLog4NetForTests();
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
//create the app context
|
||||
ApplicationContext.Current = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper());
|
||||
|
||||
_httpContextFactory = new FakeHttpContextFactory("~/Home");
|
||||
//ensure the StateHelper is using our custom context
|
||||
StateHelper.HttpContext = _httpContextFactory.HttpContext;
|
||||
_httpContextFactory = new FakeHttpContextFactory("~/Home");
|
||||
//ensure the StateHelper is using our custom context
|
||||
StateHelper.HttpContext = _httpContextFactory.HttpContext;
|
||||
|
||||
var settings = SettingsForTests.GetMockSettings();
|
||||
var contentMock = Mock.Get(settings.Content);
|
||||
contentMock.Setup(x => x.UseLegacyXmlSchema).Returns(false);
|
||||
SettingsForTests.ConfigureSettings(settings);
|
||||
|
||||
_xml = new XmlDocument();
|
||||
_xml.LoadXml(GetXml());
|
||||
var cache = new PublishedContentCache
|
||||
{
|
||||
GetXmlDelegate = (context, preview) =>
|
||||
{
|
||||
var doc = new XmlDocument();
|
||||
doc.LoadXml(GetXml());
|
||||
return doc;
|
||||
}
|
||||
GetXmlDelegate = (context, preview) => _xml
|
||||
};
|
||||
|
||||
_umbracoContext = new UmbracoContext(
|
||||
@@ -99,33 +96,31 @@ namespace Umbraco.Tests.PublishedCache
|
||||
new WebSecurity(_httpContextFactory.HttpContext, ApplicationContext.Current));
|
||||
|
||||
_cache = _umbracoContext.ContentCache;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupForLegacy()
|
||||
private void SetupForLegacy()
|
||||
{
|
||||
var settings = SettingsForTests.GetMockSettings();
|
||||
var contentMock = Mock.Get(settings.Content);
|
||||
contentMock.Setup(x => x.UseLegacyXmlSchema).Returns(true);
|
||||
SettingsForTests.ConfigureSettings(settings);
|
||||
|
||||
var cache = _umbracoContext.ContentCache.InnerCache as PublishedContentCache;
|
||||
if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported.");
|
||||
|
||||
cache.GetXmlDelegate = (context, preview) =>
|
||||
{
|
||||
var doc = new XmlDocument();
|
||||
doc.LoadXml(GetLegacyXml());
|
||||
return doc;
|
||||
};
|
||||
_xml = new XmlDocument();
|
||||
_xml.LoadXml(GetLegacyXml());
|
||||
}
|
||||
|
||||
protected override void FreezeResolution()
|
||||
{
|
||||
PublishedContentModelFactoryResolver.Current = new PublishedContentModelFactoryResolver();
|
||||
base.FreezeResolution();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
SettingsForTests.Reset();
|
||||
UmbracoSettings.Reset();
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Test]
|
||||
public void Has_Content_LegacySchema()
|
||||
{
|
||||
SetupForLegacy();
|
||||
|
||||
Reference in New Issue
Block a user