2013-02-21 21:01:00 +06:00
|
|
|
using Umbraco.Core;
|
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);
|
|
|
|
|
UmbracoContext.Current = rCtx.UmbracoContext;
|
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(
|
2015-05-05 19:01:49 +10:00
|
|
|
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();
|
2013-02-21 21:01:00 +06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void TearDown()
|
|
|
|
|
{
|
|
|
|
|
base.TearDown();
|
2013-03-13 18:31:07 +04:00
|
|
|
|
2013-02-21 21:01:00 +06:00
|
|
|
UmbracoContext.Current = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|