Updates unit tests to use the newer new ContentType method and obsoletes the old one

This commit is contained in:
Sebastiaan Janssen
2014-12-10 11:42:45 +01:00
parent f1107b7a91
commit 899d325ca1
4 changed files with 14 additions and 13 deletions

View File

@@ -15,7 +15,7 @@ namespace Umbraco.Core.Models
{
private int _defaultTemplate;
private IEnumerable<ITemplate> _allowedTemplates;
/// <summary>
/// Constuctor for creating a ContentType with the parent's id.
/// </summary>
@@ -31,9 +31,10 @@ namespace Umbraco.Core.Models
/// </summary>
/// <remarks>Use this to ensure inheritance from parent.</remarks>
/// <param name="parent"></param>
public ContentType(IContentType parent) : this(parent, null)
{
}
[Obsolete("This method is obsolete, use ContentType(IContentType parent, string alias) instead.", false)]
public ContentType(IContentType parent) : this(parent, null)
{
}
/// <summary>
/// Constuctor for creating a ContentType with the parent as an inherited type.
@@ -49,7 +50,7 @@ namespace Umbraco.Core.Models
private static readonly PropertyInfo DefaultTemplateSelector = ExpressionHelper.GetPropertyInfo<ContentType, int>(x => x.DefaultTemplateId);
private static readonly PropertyInfo AllowedTemplatesSelector = ExpressionHelper.GetPropertyInfo<ContentType, IEnumerable<ITemplate>>(x => x.AllowedTemplates);
/// <summary>
/// Gets or sets the alias of the default Template.
/// </summary>
@@ -106,7 +107,7 @@ namespace Umbraco.Core.Models
}
DefaultTemplateId = template.Id;
if(_allowedTemplates.Any(x => x != null && x.Id == template.Id) == false)
if (_allowedTemplates.Any(x => x != null && x.Id == template.Id) == false)
{
var templates = AllowedTemplates.ToList();
templates.Add(template);
@@ -140,7 +141,7 @@ namespace Umbraco.Core.Models
{
base.AddingEntity();
if(Key == Guid.Empty)
if (Key == Guid.Empty)
Key = Guid.NewGuid();
}
@@ -151,7 +152,7 @@ namespace Umbraco.Core.Models
/// <returns></returns>
[Obsolete("Use DeepCloneWithResetIdentities instead")]
public IContentType Clone(string alias)
{
{
return DeepCloneWithResetIdentities(alias);
}

View File

@@ -74,7 +74,7 @@ namespace Umbraco.Tests.PublishedContent
{
var contentTypeService = ctx.Application.Services.ContentTypeService;
var baseType = new ContentType(-1) {Alias = "base", Name = "Base"};
var inheritedType = new ContentType(baseType) {Alias = "inherited", Name = "Inherited"};
var inheritedType = new ContentType(baseType, baseType.Alias) {Alias = "inherited", Name = "Inherited"};
contentTypeService.Save(baseType);
contentTypeService.Save(inheritedType);
createContentTypes = false;

View File

@@ -178,7 +178,7 @@ namespace Umbraco.Tests.Services
/*,"Navigation"*/);
cts.Save(ctBase);
var ctHomePage = new ContentType(ctBase)
var ctHomePage = new ContentType(ctBase, ctBase.Alias)
{
Name = "Home Page",
Alias = "HomePage",
@@ -487,7 +487,7 @@ namespace Umbraco.Tests.Services
private ContentType CreateBannerComponent(ContentType parent)
{
var banner = new ContentType(parent)
var banner = new ContentType(parent, parent.Alias)
{
Alias = "banner",
Name = "Banner Component",
@@ -535,7 +535,7 @@ namespace Umbraco.Tests.Services
private ContentType CreateHomepage(ContentType parent)
{
var contentType = new ContentType(parent)
var contentType = new ContentType(parent, parent.Alias)
{
Alias = "homepage",
Name = "Homepage",

View File

@@ -94,7 +94,7 @@ namespace Umbraco.Tests.TestHelpers.Entities
public static ContentType CreateSimpleContentType(string alias, string name, IContentType parent = null, bool randomizeAliases = false)
{
var contentType = parent == null ? new ContentType(-1) : new ContentType(parent);
var contentType = parent == null ? new ContentType(-1) : new ContentType(parent, parent.Alias);
contentType.Alias = alias;
contentType.Name = name;