PublishedContent - the big refactoring

This commit is contained in:
Stephan
2013-09-05 17:47:13 +02:00
parent 912716f889
commit 0415a31d0e
115 changed files with 6366 additions and 6233 deletions

View File

@@ -93,7 +93,7 @@ namespace Umbraco.Tests.CodeFirst
//Using this attribute to hide Properties from Intellisense (when compiled?)
[EditorBrowsable(EditorBrowsableState.Never)]
public ICollection<IPublishedContentProperty> Properties
public ICollection<IPublishedProperty> Properties
{
get { return _content.Properties; }
}
@@ -107,7 +107,7 @@ namespace Umbraco.Tests.CodeFirst
//Using this attribute to hide Properties from Intellisense (when compiled?)
[EditorBrowsable(EditorBrowsableState.Never)]
public IPublishedContentProperty GetProperty(string alias)
public IPublishedProperty GetProperty(string alias)
{
return _content.GetProperty(alias);
}

View File

@@ -1,8 +1,12 @@
using System.IO;
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Umbraco.Tests.CodeFirst.TestModels;
using Umbraco.Tests.PublishedContent;
using Umbraco.Tests.TestHelpers;
@@ -58,9 +62,33 @@ namespace Umbraco.Tests.CodeFirst
#region Test setup
public override void Initialize()
{
// required so we can access property.Value
//PropertyValueConvertersResolver.Current = new PropertyValueConvertersResolver();
TestHelper.EnsureUmbracoSettingsConfig();
base.Initialize();
// need to specify a custom callback for unit tests
// AutoPublishedContentTypes generates properties automatically
// when they are requested, but we must declare those that we
// explicitely want to be here...
var propertyTypes = new[]
{
// AutoPublishedContentType will auto-generate other properties
new PublishedPropertyType("siteDescription", Guid.Empty, 0, 0),
new PublishedPropertyType("siteName", Guid.Empty, 0, 0),
new PublishedPropertyType("articleContent", Guid.Empty, 0, 0),
new PublishedPropertyType("articleAuthor", Guid.Empty, 0, 0),
new PublishedPropertyType("articleDate", Guid.Empty, 0, 0),
new PublishedPropertyType("pageTitle", Guid.Empty, 0, 0),
};
var type = new AutoPublishedContentType(0, "anything", propertyTypes);
PublishedContentType.GetPublishedContentTypeCallback = (alias) => type;
Console.WriteLine("INIT STRONG {0}",
PublishedContentType.Get(PublishedItemType.Content, "anything")
.PropertyTypes.Count());
}
public override void TearDown()

View File

@@ -10,6 +10,8 @@ namespace Umbraco.Tests.CodeFirst.TestModels
[PropertyType(typeof(TextFieldDataType))]
public string SiteName { get; set; }
// fixme - yet the property alias is "siteDescription"?
[Alias("umbSiteDescription", Name = "Site Description")]
[PropertyType(typeof(textfieldMultipleDataType))]
public string SiteDescription { get; set; }