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

45 lines
1.7 KiB
C#
Raw Normal View History

using Umbraco.Core;
using Umbraco.Core.DI;
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()
{
// fixme - what about the if (PropertyValueConvertersResolver.HasCurrent == false) ??
// can we risk double - registering and then, what happens?
Container.RegisterCollectionBuilder<PropertyValueConverterCollectionBuilder>()
.Append<DatePickerValueConverter>()
.Append<TinyMceValueConverter>()
.Append<YesNoValueConverter>();
2013-02-21 21:33:21 +06:00
base.FreezeResolution();
}
}
}