2013-02-21 21:01:00 +06:00
|
|
|
using Umbraco.Core;
|
2016-10-07 14:34:55 +02:00
|
|
|
using Umbraco.Core.DI;
|
2013-09-05 17:47:13 +02:00
|
|
|
using Umbraco.Core.Models.PublishedContent;
|
2013-02-21 21:01:00 +06:00
|
|
|
using Umbraco.Core.PropertyEditors;
|
2013-09-23 16:30:24 +02:00
|
|
|
using Umbraco.Core.PropertyEditors.ValueConverters;
|
2013-02-21 21:01:00 +06:00
|
|
|
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-04-01 23:30:19 +06:00
|
|
|
|
2013-09-05 17:47:13 +02:00
|
|
|
// need to specify a custom callback for unit tests
|
|
|
|
|
var propertyTypes = new[]
|
2013-02-21 21:01:00 +06:00
|
|
|
{
|
2013-09-05 17:47:13 +02:00
|
|
|
// AutoPublishedContentType will auto-generate other properties
|
2013-11-14 13:39:03 +11:00
|
|
|
new PublishedPropertyType("content", 0, Constants.PropertyEditors.TinyMCEAlias),
|
2013-02-21 21:01:00 +06:00
|
|
|
};
|
2013-09-05 17:47:13 +02:00
|
|
|
var type = new AutoPublishedContentType(0, "anything", propertyTypes);
|
2016-05-26 17:12:04 +02:00
|
|
|
ContentTypesCache.GetPublishedContentTypeByAlias = (alias) => type;
|
2013-02-21 21:01:00 +06:00
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
{
|
2016-08-19 11:42:23 +02:00
|
|
|
// fixme - what about the if (PropertyValueConvertersResolver.HasCurrent == false) ??
|
|
|
|
|
// can we risk double - registering and then, what happens?
|
2016-10-07 14:34:55 +02:00
|
|
|
Container.RegisterCollectionBuilder<PropertyValueConverterCollectionBuilder>()
|
2016-08-19 11:42:23 +02:00
|
|
|
.Append<DatePickerValueConverter>()
|
|
|
|
|
.Append<TinyMceValueConverter>()
|
|
|
|
|
.Append<YesNoValueConverter>();
|
2013-02-21 21:33:21 +06:00
|
|
|
|
|
|
|
|
base.FreezeResolution();
|
2013-02-21 21:01:00 +06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|