Files
Umbraco-CMS/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs

50 lines
1.9 KiB
C#
Raw Normal View History

using Umbraco.Core;
2013-09-05 17:47:13 +02:00
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.PropertyEditors.ValueConverters;
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();
2013-09-05 17:47:13 +02:00
// need to specify a custom callback for unit tests
var propertyTypes = new[]
{
2013-09-05 17:47:13 +02:00
// AutoPublishedContentType will auto-generate other properties
new PublishedPropertyType("content", 0, Constants.PropertyEditors.TinyMCEAlias),
};
2013-09-05 17:47:13 +02:00
var type = new AutoPublishedContentType(0, "anything", propertyTypes);
ContentTypesCache.GetPublishedContentTypeByAlias = (alias) => type;
var rCtx = GetRoutingContext("/test", 1234);
2016-06-09 11:57:13 +02:00
Umbraco.Web.Current.SetUmbracoContext(rCtx.UmbracoContext, true);
2013-02-21 21:33:21 +06:00
}
protected override void FreezeResolution()
{
2013-09-24 10:49:30 +02:00
if (PropertyValueConvertersResolver.HasCurrent == false)
PropertyValueConvertersResolver.Current = new PropertyValueConvertersResolver(
Container, Logger,
2013-09-24 10:49:30 +02:00
new[]
{
typeof(DatePickerValueConverter),
typeof(TinyMceValueConverter),
typeof(YesNoValueConverter)
});
2013-02-21 21:33:21 +06:00
2013-09-05 17:47:13 +02:00
if (PublishedContentModelFactoryResolver.HasCurrent == false)
PublishedContentModelFactoryResolver.Current = new PublishedContentModelFactoryResolver();
2013-02-21 21:33:21 +06:00
base.FreezeResolution();
}
}
}