Merge
This commit is contained in:
@@ -15,7 +15,7 @@ using umbraco.BusinessLogic;
|
||||
namespace Umbraco.Tests.ContentStores
|
||||
{
|
||||
[TestFixture]
|
||||
public class PublishMediaStoreTests : BaseWebTest
|
||||
public class PublishMediaStoreTests : PublishedContentTestBase
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -30,16 +30,11 @@ namespace Umbraco.Tests.ContentStores
|
||||
Path.Combine(currDir.Parent.Parent.FullName, "config", "umbracoSettings.config"),
|
||||
true);
|
||||
|
||||
Core.Configuration.UmbracoSettings.SettingsFilePath = Core.IO.IOHelper.MapPath(Core.IO.SystemDirectories.Config + Path.DirectorySeparatorChar, false);
|
||||
|
||||
//we're going to use the same initialization as the PublishedMediaTests
|
||||
PublishedMediaTests.DoInitialization(GetUmbracoContext("/test", 1234));
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
PublishedMediaTests.DoTearDown();
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
|
||||
@@ -110,7 +110,6 @@ namespace Umbraco.Tests.IO
|
||||
_fileSystem.DeleteDirectory("test", true);
|
||||
}
|
||||
|
||||
[Ignore]
|
||||
[Test]
|
||||
public void Can_Get_File_Dates()
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ using Umbraco.Tests.TestHelpers;
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
[TestFixture]
|
||||
public abstract class DynamicDocumentTestsBase<TDocument, TDocumentList> : BaseRoutingTest
|
||||
public abstract class DynamicDocumentTestsBase<TDocument, TDocumentList> : PublishedContentTestBase
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -1,56 +1,22 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Models;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
[TestFixture]
|
||||
[TestFixture]
|
||||
public class DynamicPublishedContentTests : DynamicDocumentTestsBase<DynamicPublishedContent, DynamicPublishedContentList>
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
|
||||
new[]
|
||||
{
|
||||
typeof(DatePickerPropertyEditorValueConverter),
|
||||
typeof(TinyMcePropertyEditorValueConverter),
|
||||
typeof(YesNoPropertyEditorValueConverter)
|
||||
});
|
||||
|
||||
UmbracoSettings.SettingsFilePath = Core.IO.IOHelper.MapPath(Core.IO.SystemDirectories.Config + Path.DirectorySeparatorChar, false);
|
||||
|
||||
//need to specify a custom callback for unit tests
|
||||
PublishedContentHelper.GetDataTypeCallback = (docTypeAlias, propertyAlias) =>
|
||||
{
|
||||
if (propertyAlias == "content")
|
||||
{
|
||||
//return the rte type id
|
||||
return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83");
|
||||
}
|
||||
return Guid.Empty;
|
||||
};
|
||||
|
||||
var rCtx = GetRoutingContext("/test", 1234);
|
||||
UmbracoContext.Current = rCtx.UmbracoContext;
|
||||
PublishedContentStoreResolver.Current = new PublishedContentStoreResolver(new DefaultPublishedContentStore());
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
PropertyEditorValueConvertersResolver.Reset();
|
||||
PublishedContentStoreResolver.Reset();
|
||||
UmbracoContext.Current = null;
|
||||
}
|
||||
|
||||
internal DynamicPublishedContent GetNode(int id)
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract base class for tests for published content and published media
|
||||
/// </summary>
|
||||
public abstract class PublishedContentTestBase : BaseRoutingTest
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
UmbracoSettings.SettingsFilePath = Core.IO.IOHelper.MapPath(Core.IO.SystemDirectories.Config + Path.DirectorySeparatorChar, false);
|
||||
|
||||
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
|
||||
new[]
|
||||
{
|
||||
typeof(DatePickerPropertyEditorValueConverter),
|
||||
typeof(TinyMcePropertyEditorValueConverter),
|
||||
typeof(YesNoPropertyEditorValueConverter)
|
||||
});
|
||||
|
||||
//need to specify a custom callback for unit tests
|
||||
PublishedContentHelper.GetDataTypeCallback = (docTypeAlias, propertyAlias) =>
|
||||
{
|
||||
if (propertyAlias == "content")
|
||||
{
|
||||
//return the rte type id
|
||||
return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83");
|
||||
}
|
||||
return Guid.Empty;
|
||||
};
|
||||
|
||||
var rCtx = GetRoutingContext("/test", 1234);
|
||||
UmbracoContext.Current = rCtx.UmbracoContext;
|
||||
PublishedContentStoreResolver.Current = new PublishedContentStoreResolver(new DefaultPublishedContentStore());
|
||||
PublishedMediaStoreResolver.Current = new PublishedMediaStoreResolver(new DefaultPublishedMediaStore());
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
PropertyEditorValueConvertersResolver.Reset();
|
||||
PublishedContentStoreResolver.Reset();
|
||||
PublishedMediaStoreResolver.Reset();
|
||||
UmbracoContext.Current = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
/// Tests the methods on IPublishedContent using the DefaultPublishedContentStore
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class PublishedContentTests : BaseWebTest
|
||||
public class PublishedContentTests : PublishedContentTestBase
|
||||
{
|
||||
protected override bool RequiresDbSetup
|
||||
{
|
||||
@@ -65,38 +65,12 @@ namespace Umbraco.Tests.PublishedContent
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
|
||||
new[]
|
||||
{
|
||||
typeof(DatePickerPropertyEditorValueConverter),
|
||||
typeof(TinyMcePropertyEditorValueConverter),
|
||||
typeof(YesNoPropertyEditorValueConverter)
|
||||
});
|
||||
|
||||
//need to specify a custom callback for unit tests
|
||||
PublishedContentHelper.GetDataTypeCallback = (docTypeAlias, propertyAlias) =>
|
||||
{
|
||||
if (propertyAlias == "content")
|
||||
{
|
||||
//return the rte type id
|
||||
return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83");
|
||||
}
|
||||
return Guid.Empty;
|
||||
};
|
||||
|
||||
var umbCtx = GetUmbracoContext("/test", 1234);
|
||||
UmbracoContext.Current = umbCtx;
|
||||
PublishedContentStoreResolver.Current = new PublishedContentStoreResolver(new DefaultPublishedContentStore());
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
PropertyEditorValueConvertersResolver.Reset();
|
||||
PublishedContentStoreResolver.Reset();
|
||||
UmbracoContext.Current = null;
|
||||
|
||||
}
|
||||
|
||||
internal IPublishedContent GetNode(int id)
|
||||
|
||||
@@ -28,64 +28,20 @@ namespace Umbraco.Tests.PublishedContent
|
||||
/// Tests the typed extension methods on IPublishedContent using the DefaultPublishedMediaStore
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class PublishedMediaTests : BaseWebTest
|
||||
public class PublishedMediaTests : PublishedContentTestBase
|
||||
{
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
DoInitialization(GetUmbracoContext("/test", 1234));
|
||||
UmbracoSettings.ForceSafeAliases = true;
|
||||
UmbracoSettings.UmbracoLibraryCacheDuration = 1800;
|
||||
UmbracoSettings.ForceSafeAliases = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shared with PublishMediaStoreTests
|
||||
/// </summary>
|
||||
/// <param name="umbContext"></param>
|
||||
internal static void DoInitialization(UmbracoContext umbContext)
|
||||
{
|
||||
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(
|
||||
new[]
|
||||
{
|
||||
typeof(DatePickerPropertyEditorValueConverter),
|
||||
typeof(TinyMcePropertyEditorValueConverter),
|
||||
typeof(YesNoPropertyEditorValueConverter)
|
||||
});
|
||||
|
||||
//need to specify a custom callback for unit tests
|
||||
PublishedContentHelper.GetDataTypeCallback = (docTypeAlias, propertyAlias) =>
|
||||
{
|
||||
if (propertyAlias == "content")
|
||||
{
|
||||
//return the rte type id
|
||||
return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83");
|
||||
}
|
||||
return Guid.Empty;
|
||||
};
|
||||
|
||||
UmbracoSettings.ForceSafeAliases = true;
|
||||
UmbracoSettings.UmbracoLibraryCacheDuration = 1800;
|
||||
|
||||
UmbracoContext.Current = umbContext;
|
||||
PublishedMediaStoreResolver.Current = new PublishedMediaStoreResolver(new DefaultPublishedMediaStore());
|
||||
|
||||
UmbracoSettings.ForceSafeAliases = true;
|
||||
}
|
||||
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
DoTearDown();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shared with PublishMediaStoreTests
|
||||
/// </summary>
|
||||
internal static void DoTearDown()
|
||||
{
|
||||
PropertyEditorValueConvertersResolver.Reset();
|
||||
UmbracoContext.Current = null;
|
||||
PublishedMediaStoreResolver.Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
@@ -13,29 +14,25 @@ using Umbraco.Web.Routing;
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
[TestFixture]
|
||||
public class StronglyTypedQueryTests : BaseRoutingTest
|
||||
public class StronglyTypedQueryTests : PublishedContentTestBase
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
UmbracoSettings.UseLegacyXmlSchema = false;
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
UmbracoSettings.ResetSetters();
|
||||
}
|
||||
|
||||
protected override bool RequiresDbSetup
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
var routingCtx = GetRoutingContext("/test", 1234);
|
||||
UmbracoContext.Current = routingCtx.UmbracoContext;
|
||||
PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver(Enumerable.Empty<Type>());
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
UmbracoContext.Current = null;
|
||||
PropertyEditorValueConvertersResolver.Reset();
|
||||
}
|
||||
|
||||
protected override string GetXmlContent(int templateId)
|
||||
{
|
||||
return @"<?xml version=""1.0"" encoding=""utf-8""?>
|
||||
@@ -87,6 +84,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void Type_Test()
|
||||
{
|
||||
@@ -96,6 +94,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
Assert.AreEqual("John Smith", result[1].ArticleAuthor);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void As_Test()
|
||||
{
|
||||
|
||||
@@ -190,6 +190,7 @@
|
||||
<Compile Include="PublishedContent\DynamicXmlConverterTests.cs" />
|
||||
<Compile Include="PublishedContent\DynamicXmlTests.cs" />
|
||||
<Compile Include="PublishedContent\PublishedContentDataTableTests.cs" />
|
||||
<Compile Include="PublishedContent\PublishedContentTestBase.cs" />
|
||||
<Compile Include="PublishedContent\PublishedContentTests.cs" />
|
||||
<Compile Include="PublishedContent\PublishedMediaTests.cs" />
|
||||
<Compile Include="PublishedContent\StronglyTypedQueryTests.cs" />
|
||||
|
||||
Reference in New Issue
Block a user