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

45 lines
1.7 KiB
C#
Raw Normal View History

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;
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 : BaseWebTest
{
2016-10-13 21:08:07 +02:00
public override void SetUp()
{
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-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-09-05 17:47:13 +02:00
var type = new AutoPublishedContentType(0, "anything", propertyTypes);
ContentTypesCache.GetPublishedContentTypeByAlias = (alias) => type;
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();
// 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>();
}
}
}