2013-02-21 21:01:00 +06:00
|
|
|
using Umbraco.Core;
|
2017-05-30 15:46:25 +02:00
|
|
|
using Umbraco.Core.Composing;
|
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>
|
2016-10-11 18:52:01 +02:00
|
|
|
public abstract class PublishedContentTestBase : BaseWebTest
|
2013-02-21 21:01:00 +06:00
|
|
|
{
|
2016-10-13 21:08:07 +02:00
|
|
|
public override void SetUp()
|
2013-02-21 21:01:00 +06:00
|
|
|
{
|
2016-10-13 21:08:07 +02:00
|
|
|
base.SetUp();
|
2016-11-07 20:50:14 +01: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
|
2016-11-07 20:50:14 +01: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
|
|
|
|
2016-10-11 18:52:01 +02:00
|
|
|
var umbracoContext = GetUmbracoContext("/test");
|
2017-05-30 18:13:11 +02:00
|
|
|
Umbraco.Web.Composing.Current.UmbracoContextAccessor.UmbracoContext = umbracoContext;
|
2013-02-21 21:33:21 +06:00
|
|
|
}
|
|
|
|
|
|
2016-11-07 20:50:14 +01:00
|
|
|
protected override void Compose()
|
2013-02-21 21:33:21 +06:00
|
|
|
{
|
2016-11-07 20:50:14 +01:00
|
|
|
base.Compose();
|
|
|
|
|
|
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:01:00 +06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|