From 8ce4993cdc9dd0b56e21180832dcb9e701b6fadb Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Tue, 7 Sep 2021 14:40:45 +0200 Subject: [PATCH] Fix failing tests because of missing property group alias --- src/Umbraco.Core/Constants-Conventions.cs | 4 +- .../Models/Mapping/PropertyTypeGroupMapper.cs | 3 +- .../Models/Mapping/TabsAndPropertiesMapper.cs | 3 +- .../Models/PropertyGroupCollection.cs | 22 +-- src/Umbraco.Core/Umbraco.Core.csproj | 1 - .../Packaging/PackageDataInstallation.cs | 14 +- .../Implement/ContentTypeRepositoryBase.cs | 8 +- .../UmbracoTestDataController.cs | 2 +- .../Builders/ContentTypeBuilder.cs | 15 +- .../Builders/MediaTypeBuilder.cs | 4 +- .../Builders/PropertyGroupBuilder.cs | 10 ++ .../Mapping/ContentTypeModelMappingTests.cs | 17 +- .../Packaging/PackageDataInstallationTests.cs | 14 +- .../Repositories/ContentTypeRepositoryTest.cs | 14 +- .../DataTypeDefinitionRepositoryTest.cs | 1 + .../Repositories/MediaTypeRepositoryTest.cs | 8 +- .../Repositories/MemberTypeRepositoryTest.cs | 2 +- .../Services/ContentServiceTests.cs | 6 +- .../Services/ContentTypeServiceTests.cs | 169 ++++++++++-------- .../ContentTypeServiceVariantsTests.cs | 102 +++++++++-- .../Services/MemberServiceTests.cs | 20 +-- .../Filters/ContentModelValidatorTests.cs | 2 +- .../Umbraco.Core/Models/ContentTests.cs | 35 ++-- .../Umbraco.Core/Models/ContentTypeTests.cs | 2 +- .../ContentTypeServiceExtensionsTests.cs | 21 ++- .../Entities/MockedContentTypes.cs | 13 +- 26 files changed, 326 insertions(+), 186 deletions(-) diff --git a/src/Umbraco.Core/Constants-Conventions.cs b/src/Umbraco.Core/Constants-Conventions.cs index decb7559f7..35032dff4c 100644 --- a/src/Umbraco.Core/Constants-Conventions.cs +++ b/src/Umbraco.Core/Constants-Conventions.cs @@ -227,12 +227,12 @@ namespace Umbraco.Cms.Core public const string FailedPasswordAttemptsLabel = "Failed Password Attempts"; /// - /// Group alias to put the membership properties on. + /// The standard properties group alias for membership properties. /// public const string StandardPropertiesGroupAlias = "membership"; /// - /// Group name to put the membership properties on. + /// The standard properties group name for membership properties. /// public const string StandardPropertiesGroupName = "Membership"; } diff --git a/src/Umbraco.Core/Models/Mapping/PropertyTypeGroupMapper.cs b/src/Umbraco.Core/Models/Mapping/PropertyTypeGroupMapper.cs index f3a7e3513a..eb4df424ba 100644 --- a/src/Umbraco.Core/Models/Mapping/PropertyTypeGroupMapper.cs +++ b/src/Umbraco.Core/Models/Mapping/PropertyTypeGroupMapper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.Logging; @@ -146,6 +146,7 @@ namespace Umbraco.Cms.Core.Models.Mapping { Id = PropertyGroupBasic.GenericPropertiesGroupId, Name = "Generic properties", + Alias = "genericProperties", SortOrder = 999, Properties = genericProperties, ContentTypeId = source.Id diff --git a/src/Umbraco.Core/Models/Mapping/TabsAndPropertiesMapper.cs b/src/Umbraco.Core/Models/Mapping/TabsAndPropertiesMapper.cs index 537e99e9e8..28003b9c35 100644 --- a/src/Umbraco.Core/Models/Mapping/TabsAndPropertiesMapper.cs +++ b/src/Umbraco.Core/Models/Mapping/TabsAndPropertiesMapper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Umbraco.Cms.Core.Dictionary; @@ -13,7 +13,6 @@ namespace Umbraco.Cms.Core.Models.Mapping { protected ICultureDictionary CultureDictionary { get; } protected ILocalizedTextService LocalizedTextService { get; } - protected IEnumerable IgnoreProperties { get; set; } protected TabsAndPropertiesMapper(ICultureDictionary cultureDictionary, ILocalizedTextService localizedTextService) diff --git a/src/Umbraco.Core/Models/PropertyGroupCollection.cs b/src/Umbraco.Core/Models/PropertyGroupCollection.cs index 44fc3777ea..f309600915 100644 --- a/src/Umbraco.Core/Models/PropertyGroupCollection.cs +++ b/src/Umbraco.Core/Models/PropertyGroupCollection.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; -using System.Linq; using System.Runtime.Serialization; using Umbraco.Extensions; @@ -26,10 +25,7 @@ namespace Umbraco.Cms.Core.Models /// Initializes a new instance of the class. /// /// The groups. - public PropertyGroupCollection(IEnumerable groups) - { - Reset(groups); - } + public PropertyGroupCollection(IEnumerable groups) => Reset(groups); /// /// Resets the collection to only contain the instances referenced in the parameter. @@ -127,16 +123,9 @@ namespace Umbraco.Cms.Core.Models base.Add(item); } - internal void ChangeKey(PropertyGroup item, string newKey) - { - ChangeItemKey(item, newKey); - } - - public bool Contains(int id) - { - return this.Any(x => x.Id == id); - } + internal void ChangeKey(PropertyGroup item, string newKey) => ChangeItemKey(item, newKey); + public bool Contains(int id) => this.IndexOfKey(id) != -1; public int IndexOfKey(string key) => this.FindIndex(x => x.Alias == key); @@ -151,10 +140,7 @@ namespace Umbraco.Cms.Core.Models /// public void ClearCollectionChangedEvents() => CollectionChanged = null; - protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs args) - { - CollectionChanged?.Invoke(this, args); - } + protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs args) => CollectionChanged?.Invoke(this, args); public object DeepClone() { diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 3f41bc16c1..9055030875 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -8,7 +8,6 @@ Umbraco CMS Core Contains the core assembly needed to run Umbraco Cms. This package only contains the assembly, and can be used for package development. Use the template in the Umbraco.Templates package to setup Umbraco Umbraco CMS - diff --git a/src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs b/src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs index bed078820a..d0f39af493 100644 --- a/src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs +++ b/src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Globalization; -using System.IO; using System.Linq; using System.Net; using System.Text; @@ -128,14 +126,10 @@ namespace Umbraco.Cms.Infrastructure.Packaging return ImportDocumentTypes(docTypeElements.ToList(), true, userId, _mediaTypeService); } - - #endregion - #region Content - public IReadOnlyList ImportContentBase( IEnumerable docs, IDictionary importedDocumentTypes, @@ -939,15 +933,15 @@ namespace Umbraco.Cms.Infrastructure.Packaging propertyType.Key = new Guid(property.Element("Key").Value); } - var tabElement = property.Element("Tab"); - if (tabElement == null || string.IsNullOrEmpty(tabElement.Value)) + var propertyGroupElement = property.Element("Tab"); + if (propertyGroupElement == null || string.IsNullOrEmpty(propertyGroupElement.Value)) { contentType.AddPropertyType(propertyType); } else { - var propertyGroupName = tabElement.Value; - var propertyGroupAlias = tabElement.Attribute("Alias")?.Value; + var propertyGroupName = propertyGroupElement.Value; + var propertyGroupAlias = propertyGroupElement.Attribute("Alias")?.Value; if (string.IsNullOrEmpty(propertyGroupAlias)) { propertyGroupAlias = propertyGroupName.ToSafeAlias(_shortStringHelper, true); diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs index 3b7ed6ab85..f9e8316f70 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Data; using System.Globalization; @@ -1383,9 +1383,9 @@ WHERE {Cms.Core.Constants.DatabaseSchema.Tables.Content}.nodeId IN (@ids) AND cm "DELETE FROM cmsContentTypeAllowedContentType WHERE AllowedId = @id", "DELETE FROM cmsContentType2ContentType WHERE parentContentTypeId = @id", "DELETE FROM cmsContentType2ContentType WHERE childContentTypeId = @id", - "DELETE FROM " + Constants.DatabaseSchema.Tables.PropertyData + " WHERE propertyTypeId IN (SELECT id FROM cmsPropertyType WHERE contentTypeId = @id)", - "DELETE FROM " + Constants.DatabaseSchema.Tables.PropertyType + " WHERE contentTypeId = @id", - "DELETE FROM " + Constants.DatabaseSchema.Tables.PropertyTypeGroup + " WHERE contenttypeNodeId = @id" + "DELETE FROM " + Cms.Core.Constants.DatabaseSchema.Tables.PropertyData + " WHERE propertyTypeId IN (SELECT id FROM cmsPropertyType WHERE contentTypeId = @id)", + "DELETE FROM " + Cms.Core.Constants.DatabaseSchema.Tables.PropertyType + " WHERE contentTypeId = @id", + "DELETE FROM " + Cms.Core.Constants.DatabaseSchema.Tables.PropertyTypeGroup + " WHERE contenttypeNodeId = @id" }; return list; } diff --git a/src/Umbraco.TestData/UmbracoTestDataController.cs b/src/Umbraco.TestData/UmbracoTestDataController.cs index 39f1227655..4fb3a1a890 100644 --- a/src/Umbraco.TestData/UmbracoTestDataController.cs +++ b/src/Umbraco.TestData/UmbracoTestDataController.cs @@ -269,7 +269,7 @@ namespace Umbraco.TestData Name = "Umbraco Test Data Content", Icon = "icon-science color-green" }; - docType.AddPropertyGroup("Content"); + docType.AddPropertyGroup("Content", "content"); docType.AddPropertyType(new PropertyType(_shortStringHelper, GetOrCreateRichText(), "review") { Name = "Review" diff --git a/src/Umbraco.Tests.Common/Builders/ContentTypeBuilder.cs b/src/Umbraco.Tests.Common/Builders/ContentTypeBuilder.cs index 39d0179825..af51f6019e 100644 --- a/src/Umbraco.Tests.Common/Builders/ContentTypeBuilder.cs +++ b/src/Umbraco.Tests.Common/Builders/ContentTypeBuilder.cs @@ -119,6 +119,7 @@ namespace Umbraco.Cms.Tests.Common.Builders if (_propertyTypeCollection != null) { PropertyGroup propertyGroup = new PropertyGroupBuilder() + .WithAlias("content") .WithName("Content") .WithSortOrder(1) .WithPropertyTypeCollection(_propertyTypeCollection) @@ -156,9 +157,9 @@ namespace Umbraco.Cms.Tests.Common.Builders .Build(); } - public static ContentType CreateSimpleContentType2(string alias, string name, IContentType parent = null, bool randomizeAliases = false, string propertyGroupName = "Content") + public static ContentType CreateSimpleContentType2(string alias, string name, IContentType parent = null, bool randomizeAliases = false, string propertyGroupAlias = "content", string propertyGroupName = "Content") { - ContentTypeBuilder builder = CreateSimpleContentTypeHelper(alias, name, parent, randomizeAliases: randomizeAliases, propertyGroupName: propertyGroupName); + ContentTypeBuilder builder = CreateSimpleContentTypeHelper(alias, name, parent, randomizeAliases: randomizeAliases, propertyGroupAlias: propertyGroupAlias, propertyGroupName: propertyGroupName); builder.AddPropertyType() .WithAlias(RandomAlias("gen", randomizeAliases)) @@ -173,10 +174,10 @@ namespace Umbraco.Cms.Tests.Common.Builders return (ContentType)builder.Build(); } - public static ContentType CreateSimpleContentType(string alias = null, string name = null, IContentType parent = null, PropertyTypeCollection propertyTypeCollection = null, bool randomizeAliases = false, string propertyGroupName = "Content", bool mandatoryProperties = false, int defaultTemplateId = 0) => - (ContentType)CreateSimpleContentTypeHelper(alias, name, parent, propertyTypeCollection, randomizeAliases, propertyGroupName, mandatoryProperties, defaultTemplateId).Build(); + public static ContentType CreateSimpleContentType(string alias = null, string name = null, IContentType parent = null, PropertyTypeCollection propertyTypeCollection = null, bool randomizeAliases = false, string propertyGroupAlias = "content", string propertyGroupName = "Content", bool mandatoryProperties = false, int defaultTemplateId = 0) => + (ContentType)CreateSimpleContentTypeHelper(alias, name, parent, propertyTypeCollection, randomizeAliases, propertyGroupAlias, propertyGroupName, mandatoryProperties, defaultTemplateId).Build(); - public static ContentTypeBuilder CreateSimpleContentTypeHelper(string alias = null, string name = null, IContentType parent = null, PropertyTypeCollection propertyTypeCollection = null, bool randomizeAliases = false, string propertyGroupName = "Content", bool mandatoryProperties = false, int defaultTemplateId = 0) + public static ContentTypeBuilder CreateSimpleContentTypeHelper(string alias = null, string name = null, IContentType parent = null, PropertyTypeCollection propertyTypeCollection = null, bool randomizeAliases = false, string propertyGroupAlias = "content", string propertyGroupName = "Content", bool mandatoryProperties = false, int defaultTemplateId = 0) { ContentTypeBuilder builder = new ContentTypeBuilder() .WithAlias(alias ?? "simple") @@ -192,6 +193,7 @@ namespace Umbraco.Cms.Tests.Common.Builders { builder = builder .AddPropertyGroup() + .WithAlias(propertyGroupAlias) .WithName(propertyGroupName) .WithSortOrder(1) .WithSupportsPublishing(true) @@ -257,6 +259,7 @@ namespace Umbraco.Cms.Tests.Common.Builders .WithAlias(alias) .WithName(name) .AddPropertyGroup() + .WithAlias("content") .WithName("Content") .WithSortOrder(1) .WithSupportsPublishing(true) @@ -276,6 +279,7 @@ namespace Umbraco.Cms.Tests.Common.Builders .Done() .AddPropertyGroup() .WithName("Meta") + .WithAlias("meta") .WithSortOrder(2) .WithSupportsPublishing(true) .AddPropertyType() @@ -306,6 +310,7 @@ namespace Umbraco.Cms.Tests.Common.Builders .WithName(name) .WithDescription($"ContentType used for {name} tags") .AddPropertyGroup() + .WithAlias(alias) .WithName(name) .WithSortOrder(2) .WithSupportsPublishing(true) diff --git a/src/Umbraco.Tests.Common/Builders/MediaTypeBuilder.cs b/src/Umbraco.Tests.Common/Builders/MediaTypeBuilder.cs index 3ae17bec2f..a9d424ba8c 100644 --- a/src/Umbraco.Tests.Common/Builders/MediaTypeBuilder.cs +++ b/src/Umbraco.Tests.Common/Builders/MediaTypeBuilder.cs @@ -124,7 +124,7 @@ namespace Umbraco.Cms.Tests.Common.Builders return mediaType; } - public static MediaType CreateSimpleMediaType(string alias, string name, IMediaType parent = null, bool randomizeAliases = false, string propertyGroupName = "Content") + public static MediaType CreateSimpleMediaType(string alias, string name, IMediaType parent = null, bool randomizeAliases = false, string propertyGroupAlias = "content", string propertyGroupName = "Content") { var builder = new MediaTypeBuilder(); IMediaType mediaType = builder @@ -132,6 +132,7 @@ namespace Umbraco.Cms.Tests.Common.Builders .WithName(name) .WithParentContentType(parent) .AddPropertyGroup() + .WithAlias(propertyGroupAlias) .WithName(propertyGroupName) .WithSortOrder(1) .AddPropertyType() @@ -261,6 +262,7 @@ namespace Umbraco.Cms.Tests.Common.Builders .WithAlias("newMediaType") .WithName("New Media Type") .AddPropertyGroup() + .WithAlias("media") .WithName("Media") .WithSortOrder(1) .AddPropertyType() diff --git a/src/Umbraco.Tests.Common/Builders/PropertyGroupBuilder.cs b/src/Umbraco.Tests.Common/Builders/PropertyGroupBuilder.cs index 0a2e2b6c48..9d0d300460 100644 --- a/src/Umbraco.Tests.Common/Builders/PropertyGroupBuilder.cs +++ b/src/Umbraco.Tests.Common/Builders/PropertyGroupBuilder.cs @@ -28,6 +28,7 @@ namespace Umbraco.Cms.Tests.Common.Builders IWithKeyBuilder, IWithCreateDateBuilder, IWithUpdateDateBuilder, + IWithAliasBuilder, IWithNameBuilder, IWithSortOrderBuilder, IWithSupportsPublishing @@ -39,6 +40,7 @@ namespace Umbraco.Cms.Tests.Common.Builders private Guid? _key; private DateTime? _createDate; private DateTime? _updateDate; + private string _alias; private string _name; private int? _sortOrder; private bool? _supportsPublishing; @@ -68,6 +70,7 @@ namespace Umbraco.Cms.Tests.Common.Builders Guid key = _key ?? Guid.NewGuid(); DateTime createDate = _createDate ?? DateTime.Now; DateTime updateDate = _updateDate ?? DateTime.Now; + var alias = _alias ?? Guid.NewGuid().ToString(); var name = _name ?? Guid.NewGuid().ToString(); var sortOrder = _sortOrder ?? 0; var supportsPublishing = _supportsPublishing ?? false; @@ -90,6 +93,7 @@ namespace Umbraco.Cms.Tests.Common.Builders { Id = id, Key = key, + Alias = alias, Name = name, SortOrder = sortOrder, CreateDate = createDate, @@ -109,6 +113,12 @@ namespace Umbraco.Cms.Tests.Common.Builders set => _key = value; } + string IWithAliasBuilder.Alias + { + get => _alias; + set => _alias = value; + } + string IWithNameBuilder.Name { get => _name; diff --git a/src/Umbraco.Tests.Integration/Umbraco.Core/Mapping/ContentTypeModelMappingTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Core/Mapping/ContentTypeModelMappingTests.cs index 87ab2857e4..3c5275429c 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Core/Mapping/ContentTypeModelMappingTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Core/Mapping/ContentTypeModelMappingTests.cs @@ -433,6 +433,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Mapping var basic = new PropertyGroupBasic { Id = 222, + Alias = "group1", Name = "Group 1", SortOrder = 1, Properties = new[] @@ -507,6 +508,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Mapping var basic = new PropertyGroupBasic { Id = 222, + Alias = "group1", Name = "Group 1", SortOrder = 1, Properties = new[] @@ -670,9 +672,9 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Mapping Mandatory = false, SortOrder = 1, DataTypeId = -88 - }, "Another tab"); + }, "anotherTab", "Another tab"); MediaTypeBuilder.EnsureAllIds(ctChild1, 7777); - MediaType contentType = MediaTypeBuilder.CreateSimpleMediaType("child2", "Child 2", ctChild1, true, "CustomGroup"); + MediaType contentType = MediaTypeBuilder.CreateSimpleMediaType("child2", "Child 2", ctChild1, true, "customGroup", "CustomGroup"); // not assigned to tab contentType.AddPropertyType(new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext) @@ -746,9 +748,9 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Mapping Mandatory = false, SortOrder = 1, DataTypeId = -88 - }, "Another tab"); + }, "anotherTab", "Another tab"); ContentTypeBuilder.EnsureAllIds(ctChild1, 7777); - ContentType contentType = ContentTypeBuilder.CreateSimpleContentType("child2", "Child 2", ctChild1, randomizeAliases: true, propertyGroupName: "CustomGroup"); + ContentType contentType = ContentTypeBuilder.CreateSimpleContentType("child2", "Child 2", ctChild1, randomizeAliases: true, propertyGroupAlias: "customGroup", propertyGroupName: "CustomGroup"); // not assigned to tab contentType.AddPropertyType(new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext) @@ -896,6 +898,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Mapping new PropertyGroupBasic() { Id = 987, + Alias = "tab1", Name = "Tab 1", SortOrder = 0, Inherited = false, @@ -943,6 +946,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Mapping new PropertyGroupBasic() { Id = 987, + Alias = "tab1", Name = "Tab 1", SortOrder = 0, Inherited = false, @@ -993,6 +997,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Mapping new PropertyGroupBasic() { Id = 987, + Alias = "tab1", Name = "Tab 1", SortOrder = 0, Inherited = false, @@ -1038,6 +1043,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Mapping new PropertyGroupBasic() { Id = 987, + Alias = "tab1", Name = "Tab 1", SortOrder = 0, Inherited = false, @@ -1063,6 +1069,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Mapping new PropertyGroupBasic() { Id = 894, + Alias = "tab2", Name = "Tab 2", SortOrder = 0, Inherited = true, @@ -1114,6 +1121,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Mapping new PropertyGroupBasic() { Id = 987, + Alias = "tab1", Name = "Tab 1", SortOrder = 0, Inherited = false, @@ -1139,6 +1147,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Mapping new PropertyGroupBasic() { Id = 894, + Alias = "tab2", Name = "Tab 2", SortOrder = 0, Inherited = true, diff --git a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Packaging/PackageDataInstallationTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Packaging/PackageDataInstallationTests.cs index 2caa8515d1..14a52cead7 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Packaging/PackageDataInstallationTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Packaging/PackageDataInstallationTests.cs @@ -116,9 +116,9 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Packaging Assert.That(uBlogsyBasePage.ContentTypeCompositionExists("uBlogsyBaseDocType"), Is.True); Assert.That(uBlogsyBasePage.PropertyTypes.Count(), Is.EqualTo(7)); Assert.That(uBlogsyBasePage.PropertyGroups.Count, Is.EqualTo(3)); - Assert.That(uBlogsyBasePage.PropertyGroups["Content"].PropertyTypes.Count, Is.EqualTo(3)); - Assert.That(uBlogsyBasePage.PropertyGroups["SEO"].PropertyTypes.Count(), Is.EqualTo(3)); - Assert.That(uBlogsyBasePage.PropertyGroups["Navigation"].PropertyTypes.Count(), Is.EqualTo(1)); + Assert.That(uBlogsyBasePage.PropertyGroups["content"].PropertyTypes.Count, Is.EqualTo(3)); + Assert.That(uBlogsyBasePage.PropertyGroups["sEO"].PropertyTypes.Count(), Is.EqualTo(3)); + Assert.That(uBlogsyBasePage.PropertyGroups["navigation"].PropertyTypes.Count(), Is.EqualTo(1)); Assert.That(uBlogsyBasePage.CompositionPropertyTypes.Count(), Is.EqualTo(12)); IContentType uBlogsyLanding = contentTypes.First(x => x.Alias == "uBlogsyLanding"); @@ -181,7 +181,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Packaging IContentType mRBasePage = contentTypes.First(x => x.Alias == "MRBasePage"); Assert.That(mRBasePage.PropertyTypes.Count(), Is.EqualTo(3)); Assert.That(mRBasePage.PropertyGroups.Count(), Is.EqualTo(1)); - Assert.That(mRBasePage.PropertyGroups["Metadaten"].PropertyTypes.Count(), Is.EqualTo(2)); + Assert.That(mRBasePage.PropertyGroups["metadaten"].PropertyTypes.Count(), Is.EqualTo(2)); IContentType mRStartPage = contentTypes.First(x => x.Alias == "MRStartPage"); Assert.That(mRStartPage.ContentTypeCompositionExists("MRBasePage"), Is.True); @@ -263,11 +263,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Packaging IContentType contentMaster = contentTypes.First(x => x.Alias == "ContentMaster"); Assert.That(contentMaster.PropertyTypes.Count(), Is.EqualTo(3)); Assert.That(contentMaster.PropertyGroups.Count(), Is.EqualTo(1)); - Assert.That(contentMaster.PropertyGroups["SEO"].PropertyTypes.Count(), Is.EqualTo(3)); + Assert.That(contentMaster.PropertyGroups["sEO"].PropertyTypes.Count(), Is.EqualTo(3)); Assert.That(contentMaster.ContentTypeCompositionExists("Base"), Is.True); - int propertyGroupId = contentMaster.PropertyGroups["SEO"].Id; - Assert.That(contentMaster.PropertyGroups["SEO"].PropertyTypes.Any(x => x.PropertyGroupId.Value != propertyGroupId), Is.False); + int propertyGroupId = contentMaster.PropertyGroups["sEO"].Id; + Assert.That(contentMaster.PropertyGroups["sEO"].PropertyTypes.Any(x => x.PropertyGroupId.Value != propertyGroupId), Is.False); } [Test] diff --git a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/ContentTypeRepositoryTest.cs b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/ContentTypeRepositoryTest.cs index 0eaeb8b088..dfe799e2b8 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/ContentTypeRepositoryTest.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/ContentTypeRepositoryTest.cs @@ -211,7 +211,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.Repos var container = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah" }; MediaTypeContainerRepository.Save(container); - ContentType contentType = ContentTypeBuilder.CreateSimpleContentType("test", "Test", propertyGroupName: "testGroup", defaultTemplateId: 0); + ContentType contentType = ContentTypeBuilder.CreateSimpleContentType("test", "Test", propertyGroupAlias: "testGroup", propertyGroupName: "testGroup", defaultTemplateId: 0); contentType.ParentId = container.Id; repository.Save(contentType); @@ -228,7 +228,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.Repos var container = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah" }; MediaTypeContainerRepository.Save(container); - IMediaType contentType = MediaTypeBuilder.CreateSimpleMediaType("test", "Test", propertyGroupName: "testGroup"); + IMediaType contentType = MediaTypeBuilder.CreateSimpleMediaType("test", "Test", propertyGroupAlias: "testGroup", propertyGroupName: "testGroup"); contentType.ParentId = container.Id; MediaTypeRepository.Save(contentType); @@ -252,7 +252,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.Repos using (IScope scope = provider.CreateScope()) { // Act - ContentType contentType = ContentTypeBuilder.CreateSimpleContentType("test", "Test", propertyGroupName: "testGroup"); + ContentType contentType = ContentTypeBuilder.CreateSimpleContentType("test", "Test", propertyGroupAlias: "testGroup", propertyGroupName: "testGroup"); ContentTypeRepository.Save(contentType); IContentType fetched = ContentTypeRepository.Get(contentType.Id); @@ -287,7 +287,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.Repos ContentTypeRepository repository = ContentTypeRepository; // Act - var contentType = (IContentType)ContentTypeBuilder.CreateSimpleContentType2("test", "Test", propertyGroupName: "testGroup"); + var contentType = (IContentType)ContentTypeBuilder.CreateSimpleContentType2("test", "Test", propertyGroupAlias: "testGroup", propertyGroupName: "testGroup"); Assert.AreEqual(4, contentType.PropertyTypes.Count()); @@ -342,7 +342,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.Repos IContentType contentType = repository.Get(_textpageContentType.Id); contentType.Thumbnail = "Doc2.png"; - contentType.PropertyGroups["Content"].PropertyTypes.Add(new PropertyType(ShortStringHelper, "test", ValueStorageType.Ntext, "subtitle") + contentType.PropertyGroups["content"].PropertyTypes.Add(new PropertyType(ShortStringHelper, "test", ValueStorageType.Ntext, "subtitle") { Name = "Subtitle", Description = "Optional Subtitle", @@ -689,7 +689,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.Repos IContentType contentType = repository.Get(_textpageContentType.Id); // Act - contentType.PropertyGroups["Meta"].PropertyTypes.Remove("description"); + contentType.PropertyGroups["meta"].PropertyTypes.Remove("description"); repository.Save(contentType); IContentType result = repository.Get(_textpageContentType.Id); @@ -988,7 +988,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.Repos LabelOnTop = true, Variations = ContentVariation.Nothing }); - elementType.PropertyGroups.Add(new PropertyGroup(contentCollection) {Name = "Content", SortOrder = 1}); + elementType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", Alias = "content", SortOrder = 1}); elementType.ResetDirtyProperties(false); elementType.SetDefaultTemplate(new Template(ShortStringHelper, "ElementType", "elementType")); repository.Save(elementType); diff --git a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs index 54ad59bba1..baa94c6e9e 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs @@ -60,6 +60,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.Repos new PropertyGroup(true) { Name = "PG1", + Alias = "pg1", PropertyTypes = new PropertyTypeCollection(true) { new PropertyType(ShortStringHelper, dataType1, "pt1") diff --git a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/MediaTypeRepositoryTest.cs b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/MediaTypeRepositoryTest.cs index 30c3bb3301..46cdca4194 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/MediaTypeRepositoryTest.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/MediaTypeRepositoryTest.cs @@ -121,7 +121,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.Repos containerRepository.Save(container); MediaType contentType = - MediaTypeBuilder.CreateSimpleMediaType("test", "Test", propertyGroupName: "testGroup"); + MediaTypeBuilder.CreateSimpleMediaType("test", "Test", propertyGroupAlias: "testGroup", propertyGroupName: "testGroup"); contentType.ParentId = container.Id; repository.Save(contentType); @@ -142,7 +142,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.Repos containerRepository.Save(container); IMediaType contentType = - MediaTypeBuilder.CreateSimpleMediaType("test", "Test", propertyGroupName: "testGroup"); + MediaTypeBuilder.CreateSimpleMediaType("test", "Test", propertyGroupAlias: "testGroup", propertyGroupName: "testGroup"); contentType.ParentId = container.Id; repository.Save(contentType); @@ -199,7 +199,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.Repos IMediaType mediaType = repository.Get(videoMediaType.Id); mediaType.Thumbnail = "Doc2.png"; - mediaType.PropertyGroups["Media"].PropertyTypes.Add(new PropertyType(ShortStringHelper, "test", ValueStorageType.Ntext, "subtitle") + mediaType.PropertyGroups["media"].PropertyTypes.Add(new PropertyType(ShortStringHelper, "test", ValueStorageType.Ntext, "subtitle") { Name = "Subtitle", Description = "Optional Subtitle", @@ -360,7 +360,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.Repos // Act IMediaType mediaTypeV2 = repository.Get(mediaType.Id); - mediaTypeV2.PropertyGroups["Media"].PropertyTypes.Remove("title"); + mediaTypeV2.PropertyGroups["media"].PropertyTypes.Remove("title"); repository.Save(mediaTypeV2); IMediaType mediaTypeV3 = repository.Get(mediaType.Id); diff --git a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/MemberTypeRepositoryTest.cs b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/MemberTypeRepositoryTest.cs index 0caa87563b..c963375e3f 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/MemberTypeRepositoryTest.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/MemberTypeRepositoryTest.cs @@ -320,7 +320,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence.Repos Assert.AreEqual(3, memberType.PropertyTypes.Count()); // add one stub property, others are still missing - memberType.AddPropertyType(stubs.First().Value, Constants.Conventions.Member.StandardPropertiesGroupName); + memberType.AddPropertyType(stubs.First().Value, Constants.Conventions.Member.StandardPropertiesGroupAlias, Constants.Conventions.Member.StandardPropertiesGroupName); // saving *new* member type adds the (missing) stub properties repository.Save(memberType); diff --git a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentServiceTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentServiceTests.cs index d10e269fad..d75d667b1c 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentServiceTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentServiceTests.cs @@ -2568,7 +2568,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services new PropertyType(ShortStringHelper, "test", ValueStorageType.Ntext) { Alias = "title", Name = "Title", Mandatory = false, DataTypeId = -88 }, }; - contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "content" }); + contentType.PropertyGroups.Add(new PropertyGroup(properties) + { + Alias = "content", + Name = "content" + }); contentType.SetDefaultTemplate(new Template(ShortStringHelper, "Textpage", "textpage")); FileService.SaveTemplate(contentType.DefaultTemplate); // else, FK violation on contentType! diff --git a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentTypeServiceTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentTypeServiceTests.cs index 88e8e1b939..e809992607 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentTypeServiceTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentTypeServiceTests.cs @@ -57,7 +57,12 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services Variations = ContentVariation.Nothing } }; - contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 }); + contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) + { + Alias = "content", + Name = "Content", + SortOrder = 1 + }); ContentTypeService.Save(contentType); contentType = ContentTypeService.Get(contentType.Id); @@ -402,7 +407,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services ContentType contentType = ContentTypeBuilder.CreateSimpleContentType("page", "Page", randomizeAliases: true, defaultTemplateId: template.Id); ContentTypeService.Save(contentType); - ContentType childContentType = ContentTypeBuilder.CreateSimpleContentType("childPage", "Child Page", contentType, randomizeAliases: true, propertyGroupName: "Child Content", defaultTemplateId: template.Id); + ContentType childContentType = ContentTypeBuilder.CreateSimpleContentType("childPage", "Child Page", contentType, randomizeAliases: true, propertyGroupAlias: "childContent", propertyGroupName: "Child Content", defaultTemplateId: template.Id); ContentTypeService.Save(childContentType); IContent content = ContentService.Create("Page 1", -1, childContentType.Alias); ContentService.Save(content); @@ -766,7 +771,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Title", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool added = composition.AddPropertyType(duplicatePropertyType, "Meta"); + bool added = composition.AddPropertyType(duplicatePropertyType, "meta", "Meta"); // Assert Assert.That(added, Is.True); @@ -803,10 +808,10 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Title", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool addedToBasePage = basePage.AddPropertyType(duplicatePropertyType, "Content"); - bool addedToAdvancedPage = advancedPage.AddPropertyType(duplicatePropertyType, "Content"); - bool addedToMeta = metaComposition.AddPropertyType(duplicatePropertyType, "Meta"); - bool addedToSeo = seoComposition.AddPropertyType(duplicatePropertyType, "Seo"); + bool addedToBasePage = basePage.AddPropertyType(duplicatePropertyType, "content", "Content"); + bool addedToAdvancedPage = advancedPage.AddPropertyType(duplicatePropertyType, "content", "Content"); + bool addedToMeta = metaComposition.AddPropertyType(duplicatePropertyType, "meta", "Meta"); + bool addedToSeo = seoComposition.AddPropertyType(duplicatePropertyType, "seo", "Seo"); // Assert Assert.That(metaAdded, Is.True); @@ -856,14 +861,14 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Body Text", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool bodyTextAdded = basePage.AddPropertyType(bodyTextPropertyType, "Content"); + bool bodyTextAdded = basePage.AddPropertyType(bodyTextPropertyType, "content", "Content"); ContentTypeService.Save(basePage); var authorPropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "author") { Name = "Author", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool authorAdded = contentPage.AddPropertyType(authorPropertyType, "Content"); + bool authorAdded = contentPage.AddPropertyType(authorPropertyType, "content", "Content"); ContentTypeService.Save(contentPage); bool compositionAdded = advancedPage.AddContentType(contentMetaComposition); @@ -874,7 +879,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Title", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool titleAdded = basePage.AddPropertyType(titlePropertyType, "Content"); + bool titleAdded = basePage.AddPropertyType(titlePropertyType, "content", "Content"); // Assert Assert.That(bodyTextAdded, Is.True); @@ -930,28 +935,28 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Body Text", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool bodyTextAdded = basePage.AddPropertyType(bodyTextPropertyType, "Content"); + bool bodyTextAdded = basePage.AddPropertyType(bodyTextPropertyType, "content", "Content"); ContentTypeService.Save(basePage); var authorPropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "author") { Name = "Author", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool authorAdded = contentPage.AddPropertyType(authorPropertyType, "Content"); + bool authorAdded = contentPage.AddPropertyType(authorPropertyType, "content", "Content"); ContentTypeService.Save(contentPage); var subtitlePropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "subtitle") { Name = "Subtitle", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool subtitleAdded = advancedPage.AddPropertyType(subtitlePropertyType, "Content"); + bool subtitleAdded = advancedPage.AddPropertyType(subtitlePropertyType, "content", "Content"); ContentTypeService.Save(advancedPage); var titlePropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "title") { Name = "Title", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool titleAdded = seoComposition.AddPropertyType(titlePropertyType, "Content"); + bool titleAdded = seoComposition.AddPropertyType(titlePropertyType, "content", "Content"); ContentTypeService.Save(seoComposition); bool seoCompositionAdded = advancedPage.AddContentType(seoComposition); @@ -1009,28 +1014,28 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Body Text", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool bodyTextAdded = basePage.AddPropertyType(bodyTextPropertyType, "Content"); + bool bodyTextAdded = basePage.AddPropertyType(bodyTextPropertyType, "content", "Content"); ContentTypeService.Save(basePage); var authorPropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "author") { Name = "Author", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool authorAdded = contentPage.AddPropertyType(authorPropertyType, "Content"); + bool authorAdded = contentPage.AddPropertyType(authorPropertyType, "content", "Content"); ContentTypeService.Save(contentPage); var subtitlePropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "subtitle") { Name = "Subtitle", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool subtitleAdded = advancedPage.AddPropertyType(subtitlePropertyType, "Content"); + bool subtitleAdded = advancedPage.AddPropertyType(subtitlePropertyType, "content", "Content"); ContentTypeService.Save(advancedPage); var titlePropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "title") { Name = "Title", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool titleAdded = seoComposition.AddPropertyType(titlePropertyType, "Content"); + bool titleAdded = seoComposition.AddPropertyType(titlePropertyType, "content", "Content"); ContentTypeService.Save(seoComposition); bool seoCompositionAdded = advancedPage.AddContentType(seoComposition); @@ -1050,7 +1055,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Test", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool testAdded = seoComposition.AddPropertyType(testPropertyType, "Content"); + bool testAdded = seoComposition.AddPropertyType(testPropertyType, "content", "Content"); ContentTypeService.Save(seoComposition); Assert.That(testAdded, Is.True); @@ -1069,9 +1074,9 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services ContentType page = ContentTypeBuilder.CreateSimpleContentType("page", "Page", randomizeAliases: true, defaultTemplateId: template.Id); ContentTypeService.Save(page); - ContentType contentPage = ContentTypeBuilder.CreateSimpleContentType("contentPage", "Content Page", page, randomizeAliases: true, propertyGroupName: "Content_", defaultTemplateId: template.Id); + ContentType contentPage = ContentTypeBuilder.CreateSimpleContentType("contentPage", "Content Page", page, randomizeAliases: true, propertyGroupAlias: "content2", propertyGroupName: "Content_", defaultTemplateId: template.Id); ContentTypeService.Save(contentPage); - ContentType advancedPage = ContentTypeBuilder.CreateSimpleContentType("advancedPage", "Advanced Page", contentPage, randomizeAliases: true, propertyGroupName: "Details", defaultTemplateId: template.Id); + ContentType advancedPage = ContentTypeBuilder.CreateSimpleContentType("advancedPage", "Advanced Page", contentPage, randomizeAliases: true, propertyGroupAlias: "details", propertyGroupName: "Details", defaultTemplateId: template.Id); ContentTypeService.Save(advancedPage); ContentType contentMetaComposition = ContentTypeBuilder.CreateContentMetaContentType(); @@ -1086,18 +1091,19 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Author", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool subtitleAdded = contentPage.AddPropertyType(subtitlePropertyType, "Content"); - bool authorAdded = contentPage.AddPropertyType(authorPropertyType, "Content"); + bool subtitleAdded = contentPage.AddPropertyType(subtitlePropertyType, "content", "Content"); + bool authorAdded = contentPage.AddPropertyType(authorPropertyType, "content", "Content"); ContentTypeService.Save(contentPage); bool compositionAdded = contentPage.AddContentType(contentMetaComposition); ContentTypeService.Save(contentPage); // Change the name of the tab on the "root" content type 'page'. - PropertyGroup propertyGroup = contentPage.PropertyGroups["Content_"]; - Assert.Throws(() => contentPage.PropertyGroups.Add(new PropertyGroup(true) + PropertyGroup propertyGroup = contentPage.PropertyGroups["content2"]; + Assert.Throws(() => contentPage.PropertyGroups.Add(new PropertyGroup(true) { Id = propertyGroup.Id, + Alias = "content", Name = "Content", SortOrder = 0 })); @@ -1127,22 +1133,22 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Title", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool titleAdded = basePage.AddPropertyType(titlePropertyType, "Content"); + bool titleAdded = basePage.AddPropertyType(titlePropertyType, "content", "Content"); var bodyTextPropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "bodyText") { Name = "Body Text", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool bodyTextAdded = contentPage.AddPropertyType(bodyTextPropertyType, "Content"); + bool bodyTextAdded = contentPage.AddPropertyType(bodyTextPropertyType, "content", "Content"); var subtitlePropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "subtitle") { Name = "Subtitle", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool subtitleAdded = contentPage.AddPropertyType(subtitlePropertyType, "Content"); + bool subtitleAdded = contentPage.AddPropertyType(subtitlePropertyType, "content", "Content"); var authorPropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "author") { Name = "Author", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool authorAdded = advancedPage.AddPropertyType(authorPropertyType, "Content"); + bool authorAdded = advancedPage.AddPropertyType(authorPropertyType, "content", "Content"); ContentTypeService.Save(basePage); ContentTypeService.Save(contentPage); ContentTypeService.Save(advancedPage); @@ -1200,7 +1206,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Title", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool addedToContentPage = contentPage.AddPropertyType(propertyType, "Content"); + bool addedToContentPage = contentPage.AddPropertyType(propertyType, "content", "Content"); // Assert Assert.That(metaAdded, Is.True); @@ -1219,7 +1225,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services // create 'page' content type with a 'Content_' group Template template = TemplateBuilder.CreateTextPageTemplate(); FileService.SaveTemplate(template); - ContentType page = ContentTypeBuilder.CreateSimpleContentType("page", "Page", propertyGroupName: "Content_", defaultTemplateId: template.Id); + ContentType page = ContentTypeBuilder.CreateSimpleContentType("page", "Page", propertyGroupAlias: "content2", propertyGroupName: "Content_", defaultTemplateId: template.Id); Assert.AreEqual(1, page.PropertyGroups.Count); Assert.AreEqual("Content_", page.PropertyGroups.First().Name); Assert.AreEqual(3, page.PropertyTypes.Count()); @@ -1245,7 +1251,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services Assert.AreEqual(2, meta.PropertyTypes.Count()); Assert.AreEqual("Meta Keywords", meta.PropertyTypes.First().Name); Assert.AreEqual("Meta Description", meta.PropertyTypes.Skip(1).First().Name); - meta.AddPropertyGroup("Content"); + meta.AddPropertyGroup("Content", "content"); Assert.AreEqual(2, meta.PropertyTypes.Count()); ContentTypeService.Save(meta); @@ -1258,7 +1264,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Test Textbox", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool prop1Added = contentPage.AddPropertyType(prop1, "Content_"); + bool prop1Added = contentPage.AddPropertyType(prop1, "content2", "Content_"); Assert.IsTrue(prop1Added); // add property 'prop2' to 'contentPage' group 'Content' @@ -1266,13 +1272,13 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Another Test Textbox", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool prop2Added = contentPage.AddPropertyType(prop2, "Content"); + bool prop2Added = contentPage.AddPropertyType(prop2, "content", "Content"); Assert.IsTrue(prop2Added); // save 'contentPage' content type ContentTypeService.Save(contentPage); - PropertyGroup group = page.PropertyGroups["Content_"]; + PropertyGroup group = page.PropertyGroups["content2"]; group.Name = "ContentTab"; // rename the group ContentTypeService.Save(page); Assert.AreEqual(3, page.PropertyTypes.Count()); @@ -1300,11 +1306,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services // Arrange Template template = TemplateBuilder.CreateTextPageTemplate(); FileService.SaveTemplate(template); - ContentType page = ContentTypeBuilder.CreateSimpleContentType("page", "Page", randomizeAliases: true, propertyGroupName: "Content_", defaultTemplateId: template.Id); + ContentType page = ContentTypeBuilder.CreateSimpleContentType("page", "Page", randomizeAliases: true, propertyGroupAlias: "content2", propertyGroupName: "Content_", defaultTemplateId: template.Id); ContentTypeService.Save(page); - ContentType contentPage = ContentTypeBuilder.CreateSimpleContentType("contentPage", "Content Page", page, randomizeAliases: true, propertyGroupName: "Contentx", defaultTemplateId: template.Id); + ContentType contentPage = ContentTypeBuilder.CreateSimpleContentType("contentPage", "Content Page", page, randomizeAliases: true, propertyGroupAlias: "contentx", propertyGroupName: "Contentx", defaultTemplateId: template.Id); ContentTypeService.Save(contentPage); - ContentType advancedPage = ContentTypeBuilder.CreateSimpleContentType("advancedPage", "Advanced Page", contentPage, randomizeAliases: true, propertyGroupName: "Contenty", defaultTemplateId: template.Id); + ContentType advancedPage = ContentTypeBuilder.CreateSimpleContentType("advancedPage", "Advanced Page", contentPage, randomizeAliases: true, propertyGroupAlias: "contenty", propertyGroupName: "Contenty", defaultTemplateId: template.Id); ContentTypeService.Save(advancedPage); ContentType contentMetaComposition = ContentTypeBuilder.CreateContentMetaContentType(); @@ -1321,8 +1327,8 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Subtitle", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool bodyTextAdded = contentPage.AddPropertyType(bodyTextPropertyType, "Content_"); // Will be added to the parent tab - bool subtitleAdded = contentPage.AddPropertyType(subtitlePropertyType, "Content"); // Will be added to the "Content Meta" composition + bool bodyTextAdded = contentPage.AddPropertyType(bodyTextPropertyType, "content2", "Content_"); // Will be added to the parent tab + bool subtitleAdded = contentPage.AddPropertyType(subtitlePropertyType, "content", "Content"); // Will be added to the "Content Meta" composition ContentTypeService.Save(contentPage); var authorPropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "author") @@ -1337,14 +1343,19 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Keywords", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool authorAdded = advancedPage.AddPropertyType(authorPropertyType, "Content_"); // Will be added to an ancestor tab - bool descriptionAdded = advancedPage.AddPropertyType(descriptionPropertyType, "Contentx"); // Will be added to a parent tab - bool keywordsAdded = advancedPage.AddPropertyType(keywordsPropertyType, "Content"); // Will be added to the "Content Meta" composition + bool authorAdded = advancedPage.AddPropertyType(authorPropertyType, "content2", "Content_"); // Will be added to an ancestor tab + bool descriptionAdded = advancedPage.AddPropertyType(descriptionPropertyType, "contentx", "Contentx"); // Will be added to a parent tab + bool keywordsAdded = advancedPage.AddPropertyType(keywordsPropertyType, "content", "Content"); // Will be added to the "Content Meta" composition ContentTypeService.Save(advancedPage); // Change the name of the tab on the "root" content type 'page'. - PropertyGroup propertyGroup = page.PropertyGroups["Content_"]; - page.PropertyGroups.Add(new PropertyGroup(true) { Id = propertyGroup.Id, Name = "Content", SortOrder = 0 }); + PropertyGroup propertyGroup = page.PropertyGroups["content2"]; + page.PropertyGroups.Add(new PropertyGroup(true) { + Id = propertyGroup.Id, + Name = "Content", + Alias = "content", + SortOrder = 0 + }); ContentTypeService.Save(page); // Assert @@ -1374,9 +1385,9 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services // Arrange Template template = TemplateBuilder.CreateTextPageTemplate(); FileService.SaveTemplate(template); - ContentType page = ContentTypeBuilder.CreateSimpleContentType("page", "Page", randomizeAliases: true, propertyGroupName: "Content_", defaultTemplateId: template.Id); + ContentType page = ContentTypeBuilder.CreateSimpleContentType("page", "Page", randomizeAliases: true, propertyGroupAlias: "content2", propertyGroupName: "Content_", defaultTemplateId: template.Id); ContentTypeService.Save(page); - ContentType contentPage = ContentTypeBuilder.CreateSimpleContentType("contentPage", "Content Page", page, randomizeAliases: true, propertyGroupName: "Content", defaultTemplateId: template.Id); + ContentType contentPage = ContentTypeBuilder.CreateSimpleContentType("contentPage", "Content Page", page, randomizeAliases: true, propertyGroupAlias: "content", propertyGroupName: "Content", defaultTemplateId: template.Id); ContentTypeService.Save(contentPage); ContentType contentMetaComposition = ContentTypeBuilder.CreateContentMetaContentType(); @@ -1395,18 +1406,24 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Author", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool bodyTextAdded = page.AddPropertyType(bodyTextPropertyType, "Content_"); - bool subtitleAdded = contentPage.AddPropertyType(subtitlePropertyType, "Content"); - bool authorAdded = contentPage.AddPropertyType(authorPropertyType, "Content_"); + bool bodyTextAdded = page.AddPropertyType(bodyTextPropertyType, "content2", "Content_"); + bool subtitleAdded = contentPage.AddPropertyType(subtitlePropertyType, "content", "Content"); + bool authorAdded = contentPage.AddPropertyType(authorPropertyType, "content2", "Content_"); ContentTypeService.Save(page); ContentTypeService.Save(contentPage); bool compositionAdded = contentPage.AddContentType(contentMetaComposition); ContentTypeService.Save(contentPage); - // Change the name of the tab on the "root" content type 'page'. - PropertyGroup propertyGroup = page.PropertyGroups["Content_"]; - page.PropertyGroups.Add(new PropertyGroup(true) { Id = propertyGroup.Id, Name = "Content", SortOrder = 0 }); + // Change the alias/name of the tab on the "root" content type 'page'. + PropertyGroup propertyGroup = page.PropertyGroups["content2"]; + page.PropertyGroups.Add(new PropertyGroup(true) + { + Id = propertyGroup.Id, + Alias = "content", + Name = "Content", + SortOrder = 0 + }); ContentTypeService.Save(page); // Assert @@ -1439,20 +1456,20 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Body Text", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool bodyTextAdded = basePage.AddPropertyType(bodyTextPropertyType, "Content"); + bool bodyTextAdded = basePage.AddPropertyType(bodyTextPropertyType, "content", "Content"); ContentTypeService.Save(basePage); var authorPropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "author") { Name = "Author", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool authorAdded = contentPage.AddPropertyType(authorPropertyType, "Content"); + bool authorAdded = contentPage.AddPropertyType(authorPropertyType, "content", "Content"); ContentTypeService.Save(contentPage); bool compositionAdded = contentPage.AddContentType(contentMetaComposition); ContentTypeService.Save(contentPage); - basePage.RemovePropertyGroup("Content"); + basePage.RemovePropertyGroup("content"); ContentTypeService.Save(basePage); // Assert @@ -1464,15 +1481,15 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services Assert.DoesNotThrow(() => ContentTypeService.Get("advancedPage")); IContentType contentType = ContentTypeService.Get("contentPage"); - PropertyGroup propertyGroup = contentType.PropertyGroups["Content"]; + PropertyGroup propertyGroup = contentType.PropertyGroups["content"]; } [Test] public void Can_Remove_PropertyGroup_Without_Removing_Property_Types() { var basePage = (IContentType)ContentTypeBuilder.CreateBasicContentType(); - basePage.AddPropertyGroup("Content"); - basePage.AddPropertyGroup("Meta"); + basePage.AddPropertyGroup("Content", "content"); + basePage.AddPropertyGroup("Meta", "meta"); ContentTypeService.Save(basePage); var authorPropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "author") @@ -1483,7 +1500,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services SortOrder = 1, DataTypeId = -88 }; - Assert.IsTrue(basePage.AddPropertyType(authorPropertyType, "Content")); + Assert.IsTrue(basePage.AddPropertyType(authorPropertyType, "content", "Content")); var titlePropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "title") { @@ -1493,7 +1510,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services SortOrder = 1, DataTypeId = -88 }; - Assert.IsTrue(basePage.AddPropertyType(titlePropertyType, "Meta")); + Assert.IsTrue(basePage.AddPropertyType(titlePropertyType, "meta", "Meta")); ContentTypeService.Save(basePage); basePage = ContentTypeService.Get(basePage.Id); @@ -1501,7 +1518,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services int count = basePage.PropertyTypes.Count(); Assert.AreEqual(2, count); - basePage.RemovePropertyGroup("Content"); + basePage.RemovePropertyGroup("content"); ContentTypeService.Save(basePage); basePage = ContentTypeService.Get(basePage.Id); @@ -1537,14 +1554,14 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Author", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool authorAdded = contentPage.AddPropertyType(authorPropertyType, "Content"); + bool authorAdded = contentPage.AddPropertyType(authorPropertyType, "content", "Content"); ContentTypeService.Save(contentPage); var bodyTextPropertyType = new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext, "bodyText") { Name = "Body Text", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool bodyTextAdded = basePage.AddPropertyType(bodyTextPropertyType, "Content"); + bool bodyTextAdded = basePage.AddPropertyType(bodyTextPropertyType, "content", "Content"); ContentTypeService.Save(basePage); bool compositionAdded = contentPage.AddContentType(contentMetaComposition); @@ -1559,7 +1576,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services Assert.DoesNotThrow(() => ContentTypeService.Get("advancedPage")); IContentType contentType = ContentTypeService.Get("contentPage"); - PropertyGroup propertyGroup = contentType.PropertyGroups["Content"]; + PropertyGroup propertyGroup = contentType.PropertyGroups["content"]; int numberOfContentTabs = contentType.CompositionPropertyGroups.Count(x => x.Name.Equals("Content")); Assert.That(numberOfContentTabs, Is.EqualTo(3)); @@ -1569,12 +1586,12 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Alias = "description", Name = "Description", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 }; - bool descriptionAdded = contentType.AddPropertyType(descriptionPropertyType, "Content"); + bool descriptionAdded = contentType.AddPropertyType(descriptionPropertyType, "content", "Content"); ContentTypeService.Save(contentType); Assert.That(descriptionAdded, Is.True); IContentType contentPageReloaded = ContentTypeService.Get("contentPage"); - PropertyGroup propertyGroupReloaded = contentPageReloaded.PropertyGroups["Content"]; + PropertyGroup propertyGroupReloaded = contentPageReloaded.PropertyGroups["content"]; bool hasDescriptionPropertyType = propertyGroupReloaded.PropertyTypes.Contains("description"); Assert.That(hasDescriptionPropertyType, Is.True); @@ -1618,17 +1635,17 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services // property is variant on A IContentType test = ContentTypeService.Get(typeA.Id); Assert.AreEqual(ContentVariation.Culture, test.CompositionPropertyTypes.First(x => x.Alias.InvariantEquals("title")).Variations); - Assert.AreEqual(ContentVariation.Culture, test.CompositionPropertyGroups.First().PropertyTypes.First(x => x.Alias.InvariantEquals("title")).Variations); + Assert.AreEqual(ContentVariation.Culture, test.CompositionPropertyGroups.Last().PropertyTypes.First(x => x.Alias.InvariantEquals("title")).Variations); // but not on B test = ContentTypeService.Get(typeB.Id); Assert.AreEqual(ContentVariation.Nothing, test.CompositionPropertyTypes.First(x => x.Alias.InvariantEquals("title")).Variations); - Assert.AreEqual(ContentVariation.Nothing, test.CompositionPropertyGroups.First().PropertyTypes.First(x => x.Alias.InvariantEquals("title")).Variations); + Assert.AreEqual(ContentVariation.Nothing, test.CompositionPropertyGroups.Last().PropertyTypes.First(x => x.Alias.InvariantEquals("title")).Variations); // but on C test = ContentTypeService.Get(typeC.Id); Assert.AreEqual(ContentVariation.Culture, test.CompositionPropertyTypes.First(x => x.Alias.InvariantEquals("title")).Variations); - Assert.AreEqual(ContentVariation.Culture, test.CompositionPropertyGroups.First().PropertyTypes.First(x => x.Alias.InvariantEquals("title")).Variations); + Assert.AreEqual(ContentVariation.Culture, test.CompositionPropertyGroups.Last().PropertyTypes.First(x => x.Alias.InvariantEquals("title")).Variations); } private ContentType CreateComponent() @@ -1649,7 +1666,13 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { new PropertyType(ShortStringHelper, "test", ValueStorageType.Ntext, "componentGroup") { Name = "Component Group", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 } }; - component.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Component", SortOrder = 1 }); + + component.PropertyGroups.Add(new PropertyGroup(contentCollection) + { + Alias= "component", + Name = "Component", + SortOrder = 1 + }); return component; } @@ -1677,7 +1700,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services SortOrder = 2, DataTypeId = -88 }; - banner.AddPropertyType(propertyType, "Component"); + banner.AddPropertyType(propertyType, "component", "Component"); return banner; } @@ -1699,7 +1722,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { new PropertyType(ShortStringHelper, "test", ValueStorageType.Ntext, "hostname") { Name = "Hostname", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 } }; - site.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Site Settings", SortOrder = 1 }); + site.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Site Settings", Alias = "siteSettings", SortOrder = 1 }); return site; } diff --git a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentTypeServiceVariantsTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentTypeServiceVariantsTests.cs index 2608295ca3..8113c1b3e9 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentTypeServiceVariantsTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentTypeServiceVariantsTests.cs @@ -139,7 +139,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services ContentType contentType = ContentTypeBuilder.CreateBasicContentType(); contentType.Variations = from; PropertyTypeCollection properties = CreatePropertyCollection(("title", from)); - contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "Content" }); + contentType.PropertyGroups.Add(new PropertyGroup(properties) + { + Alias = "content", + Name = "Content" + }); ContentTypeService.Save(contentType); // create some content of this content type @@ -189,7 +193,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services ContentType contentType = ContentTypeBuilder.CreateBasicContentType(); contentType.Variations = startingContentTypeVariation; PropertyTypeCollection properties = CreatePropertyCollection(("title", startingContentTypeVariation)); - contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "Content" }); + contentType.PropertyGroups.Add(new PropertyGroup(properties) + { + Alias = "content", + Name = "Content" + }); ContentTypeService.Save(contentType); // create some content of this content type @@ -349,7 +357,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services // Update it contentType.Variations = contentTypeVariation; PropertyTypeCollection properties = CreatePropertyCollection(("title", propertyTypeVariation)); - contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "Content" }); + contentType.PropertyGroups.Add(new PropertyGroup(properties) + { + Alias = "content", + Name = "Content" + }); ContentTypeService.Save(contentType); // Check if property type variations have been updated correctly @@ -367,7 +379,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services // content type supports all variations contentType.Variations = ContentVariation.Culture | ContentVariation.Segment; PropertyTypeCollection properties = CreatePropertyCollection(("title", invariant)); - contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "Content" }); + contentType.PropertyGroups.Add(new PropertyGroup(properties) + { + Alias = "content", + Name = "Content" + }); ContentTypeService.Save(contentType); // create some content of this content type @@ -412,7 +428,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services // content type supports all variations contentType.Variations = ContentVariation.Culture | ContentVariation.Segment; PropertyTypeCollection properties = CreatePropertyCollection(("title", variant)); - contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "Content" }); + contentType.PropertyGroups.Add(new PropertyGroup(properties) + { + Alias = "content", + Name = "Content" + }); ContentTypeService.Save(contentType); // create some content of this content type @@ -450,7 +470,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services // content type supports all variations contentType.Variations = ContentVariation.Culture | ContentVariation.Segment; PropertyTypeCollection properties = CreatePropertyCollection(("title", variant)); - contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "Content" }); + contentType.PropertyGroups.Add(new PropertyGroup(properties) + { + Alias = "content", + Name = "Content" + }); ContentTypeService.Save(contentType); // compose this from the other one @@ -499,7 +523,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services ContentType contentType = ContentTypeBuilder.CreateBasicContentType(); contentType.Variations = variant; PropertyTypeCollection properties = CreatePropertyCollection(("title", ContentVariation.Culture)); - contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "Content" }); + contentType.PropertyGroups.Add(new PropertyGroup(properties) + { + Alias = "content", + Name = "Content" + }); ContentTypeService.Save(contentType); // compose this from the other one @@ -552,7 +580,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services ("value1", ContentVariation.Culture), ("value2", ContentVariation.Nothing)); - contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "Content" }); + contentType.PropertyGroups.Add(new PropertyGroup(properties) + { + Alias = "content", + Name = "Content" + }); ContentTypeService.Save(contentType); var document = (IContent)new Content("document", -1, contentType); @@ -649,7 +681,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services ("value1", ContentVariation.Nothing), ("value2", ContentVariation.Nothing)); - contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "Content" }); + contentType.PropertyGroups.Add(new PropertyGroup(properties) + { + Alias = "content", + Name = "Content" + }); ContentTypeService.Save(contentType); var document = (IContent)new Content("document", -1, contentType); @@ -737,7 +773,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services ("value1", ContentVariation.Culture), ("value2", ContentVariation.Nothing)); - contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "Content" }); + contentType.PropertyGroups.Add(new PropertyGroup(properties) + { + Alias = "content", + Name = "Content" + }); ContentTypeService.Save(contentType); var document = (IContent)new Content("document", -1, contentType); @@ -830,7 +870,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services PropertyTypeCollection properties = CreatePropertyCollection(("value1", variant)); - contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "Content" }); + contentType.PropertyGroups.Add(new PropertyGroup(properties) + { + Alias = "content", + Name = "Content" + }); ContentTypeService.Save(contentType); IContent document = new Content("document", -1, contentType); @@ -932,7 +976,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services PropertyTypeCollection properties = CreatePropertyCollection(("value1", invariant)); - contentType.PropertyGroups.Add(new PropertyGroup(properties) { Name = "Content" }); + contentType.PropertyGroups.Add(new PropertyGroup(properties) + { + Alias = "content", + Name = "Content" + }); ContentTypeService.Save(contentType); var document = (IContent)new Content("document", -1, contentType); @@ -1013,7 +1061,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services ("value11", ContentVariation.Culture), ("value12", ContentVariation.Nothing)); - composing.PropertyGroups.Add(new PropertyGroup(properties1) { Name = "Content" }); + composing.PropertyGroups.Add(new PropertyGroup(properties1) + { + Alias = "content", + Name = "Content" + }); ContentTypeService.Save(composing); IContentType composed = CreateContentType(ContentVariation.Culture, "composed"); @@ -1022,7 +1074,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services ("value21", ContentVariation.Culture), ("value22", ContentVariation.Nothing)); - composed.PropertyGroups.Add(new PropertyGroup(properties2) { Name = "Content" }); + composed.PropertyGroups.Add(new PropertyGroup(properties2) + { + Alias = "content", + Name = "Content" + }); composed.AddContentType(composing); ContentTypeService.Save(composed); @@ -1114,7 +1170,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services ("value11", ContentVariation.Culture), ("value12", ContentVariation.Nothing)); - composing.PropertyGroups.Add(new PropertyGroup(properties1) { Name = "Content" }); + composing.PropertyGroups.Add(new PropertyGroup(properties1) + { + Alias = "content", + Name = "Content" + }); ContentTypeService.Save(composing); IContentType composed1 = CreateContentType(ContentVariation.Culture, "composed1"); @@ -1123,7 +1183,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services ("value21", ContentVariation.Culture), ("value22", ContentVariation.Nothing)); - composed1.PropertyGroups.Add(new PropertyGroup(properties2) { Name = "Content" }); + composed1.PropertyGroups.Add(new PropertyGroup(properties2) + { + Alias = "content", + Name = "Content" + }); composed1.AddContentType(composing); ContentTypeService.Save(composed1); @@ -1133,7 +1197,11 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services ("value31", ContentVariation.Nothing), ("value32", ContentVariation.Nothing)); - composed2.PropertyGroups.Add(new PropertyGroup(properties3) { Name = "Content" }); + composed2.PropertyGroups.Add(new PropertyGroup(properties3) + { + Alias = "content", + Name = "Content" + }); composed2.AddContentType(composing); ContentTypeService.Save(composed2); diff --git a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/MemberServiceTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/MemberServiceTests.cs index c4381c58d3..96a91af10f 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/MemberServiceTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/MemberServiceTests.cs @@ -914,7 +914,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Number", DataTypeId = -51, // NOTE: This is what really determines the db type - the above definition doesn't really do anything - }, "Content"); + }, "content", "Content"); MemberTypeService.Save(memberType); IEnumerable members = MemberBuilder.CreateMultipleSimpleMembers(memberType, 10, (i, member) => member.SetValue("number", i)); MemberService.Save(members); @@ -942,7 +942,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Number", DataTypeId = -51, // NOTE: This is what really determines the db type - the above definition doesn't really do anything - }, "Content"); + }, "content", "Content"); MemberTypeService.Save(memberType); IEnumerable members = MemberBuilder.CreateMultipleSimpleMembers(memberType, 10, (i, member) => member.SetValue("number", i)); MemberService.Save(members); @@ -970,7 +970,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Number", DataTypeId = -51, // NOTE: This is what really determines the db type - the above definition doesn't really do anything - }, "Content"); + }, "content", "Content"); MemberTypeService.Save(memberType); IEnumerable members = MemberBuilder.CreateMultipleSimpleMembers(memberType, 10, (i, member) => member.SetValue("number", i)); MemberService.Save(members); @@ -998,7 +998,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Number", DataTypeId = -51, // NOTE: This is what really determines the db type - the above definition doesn't really do anything - }, "Content"); + }, "content", "Content"); MemberTypeService.Save(memberType); IEnumerable members = MemberBuilder.CreateMultipleSimpleMembers(memberType, 10, (i, member) => member.SetValue("number", i)); MemberService.Save(members); @@ -1026,7 +1026,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Number", DataTypeId = -51, // NOTE: This is what really determines the db type - the above definition doesn't really do anything - }, "Content"); + }, "content", "Content"); MemberTypeService.Save(memberType); IEnumerable members = MemberBuilder.CreateMultipleSimpleMembers(memberType, 10, (i, member) => member.SetValue("number", i)); MemberService.Save(members); @@ -1054,7 +1054,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Date", DataTypeId = -36, // NOTE: This is what really determines the db type - the above definition doesn't really do anything - }, "Content"); + }, "content", "Content"); MemberTypeService.Save(memberType); IEnumerable members = MemberBuilder.CreateMultipleSimpleMembers(memberType, 10, (i, member) => member.SetValue("date", new DateTime(2013, 12, 20, 1, i, 0))); MemberService.Save(members); @@ -1082,7 +1082,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Date", DataTypeId = -36, // NOTE: This is what really determines the db type - the above definition doesn't really do anything - }, "Content"); + }, "content", "Content"); MemberTypeService.Save(memberType); IEnumerable members = MemberBuilder.CreateMultipleSimpleMembers(memberType, 10, (i, member) => member.SetValue("date", new DateTime(2013, 12, 20, 1, i, 0))); MemberService.Save(members); @@ -1110,7 +1110,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Date", DataTypeId = -36, // NOTE: This is what really determines the db type - the above definition doesn't really do anything - }, "Content"); + }, "content", "Content"); MemberTypeService.Save(memberType); IEnumerable members = MemberBuilder.CreateMultipleSimpleMembers(memberType, 10, (i, member) => member.SetValue("date", new DateTime(2013, 12, 20, 1, i, 0))); MemberService.Save(members); @@ -1138,7 +1138,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Date", DataTypeId = -36, // NOTE: This is what really determines the db type - the above definition doesn't really do anything - }, "Content"); + }, "content", "Content"); MemberTypeService.Save(memberType); IEnumerable members = MemberBuilder.CreateMultipleSimpleMembers(memberType, 10, (i, member) => member.SetValue("date", new DateTime(2013, 12, 20, 1, i, 0))); MemberService.Save(members); @@ -1166,7 +1166,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services { Name = "Date", DataTypeId = -36, // NOTE: This is what really determines the db type - the above definition doesn't really do anything - }, "Content"); + }, "content", "Content"); MemberTypeService.Save(memberType); IEnumerable members = MemberBuilder.CreateMultipleSimpleMembers(memberType, 10, (i, member) => member.SetValue("date", new DateTime(2013, 12, 20, 1, i, 0))); MemberService.Save(members); diff --git a/src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/Filters/ContentModelValidatorTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/Filters/ContentModelValidatorTests.cs index f550f83566..5ef60b9ecb 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/Filters/ContentModelValidatorTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/Filters/ContentModelValidatorTests.cs @@ -83,7 +83,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Web.BackOffice.Filters _contentType.AddPropertyType( new PropertyType(_shortStringHelper, "complexTest", ValueStorageType.Ntext) { Alias = "complex", Name = "Complex", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = complexDataType.Id }, - "Content"); + "content", "Content"); // make them all validate with a regex rule that will not pass foreach (IPropertyType prop in _contentType.PropertyTypes) diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Models/ContentTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Models/ContentTests.cs index 21d495f3a0..718559af39 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Models/ContentTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Models/ContentTests.cs @@ -570,7 +570,12 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Models ContentType contentType = ContentTypeBuilder.CreateTextPageContentType(); // Act - contentType.PropertyGroups.Add(new PropertyGroup(true) { Name = "Test Group", SortOrder = 3 }); + contentType.PropertyGroups.Add(new PropertyGroup(true) + { + Alias = "testGroup", + Name = "Test Group", + SortOrder = 3 + }); // Assert Assert.That(contentType.PropertyGroups.Count, Is.EqualTo(3)); @@ -584,7 +589,7 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Models contentType.ResetDirtyProperties(); // Act - contentType.PropertyGroups.Remove("Content"); + contentType.PropertyGroups.Remove("content"); // Assert Assert.That(contentType.PropertyGroups.Count, Is.EqualTo(1)); @@ -602,10 +607,10 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Models .WithAlias("subtitle") .WithName("Subtitle") .Build(); - contentType.PropertyGroups["Content"].PropertyTypes.Add(propertyType); + contentType.PropertyGroups["content"].PropertyTypes.Add(propertyType); // Assert - Assert.That(contentType.PropertyGroups["Content"].PropertyTypes.Count, Is.EqualTo(3)); + Assert.That(contentType.PropertyGroups["content"].PropertyTypes.Count, Is.EqualTo(3)); } [Test] @@ -622,7 +627,7 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Models .WithAlias("subtitle") .WithName("Subtitle") .Build(); - contentType.PropertyGroups["Content"].PropertyTypes.Add(propertyType); + contentType.PropertyGroups["content"].PropertyTypes.Add(propertyType); var newProperty = new Property(propertyType); newProperty.SetValue("This is a subtitle Test"); content.Properties.Add(newProperty); @@ -646,7 +651,12 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Models .WithAlias("subtitle") .WithName("Subtitle") .Build(); - var propertyGroup = new PropertyGroup(true) { Name = "Test Group", SortOrder = 3 }; + var propertyGroup = new PropertyGroup(true) + { + Alias = "testGroup", + Name = "Test Group", + SortOrder = 3 + }; propertyGroup.PropertyTypes.Add(propertyType); contentType.PropertyGroups.Add(propertyGroup); var newProperty = new Property(propertyType); @@ -806,7 +816,12 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Models contentType.ResetDirtyProperties(); // Act - var propertyGroup = new PropertyGroup(true) { Name = "Test Group", SortOrder = 3 }; + var propertyGroup = new PropertyGroup(true) + { + Alias = "testGroup", + Name = "Test Group", + SortOrder = 3 + }; contentType.PropertyGroups.Add(propertyGroup); // Assert @@ -904,11 +919,11 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Models .WithAlias("subtitle") .WithName("Subtitle") .Build(); - contentType.PropertyGroups["Content"].PropertyTypes.Add(propertyType); + contentType.PropertyGroups["content"].PropertyTypes.Add(propertyType); // Assert - Assert.That(contentType.PropertyGroups["Content"].IsDirty(), Is.True); - Assert.That(contentType.PropertyGroups["Content"].IsPropertyDirty("PropertyTypes"), Is.True); + Assert.That(contentType.PropertyGroups["content"].IsDirty(), Is.True); + Assert.That(contentType.PropertyGroups["content"].IsPropertyDirty("PropertyTypes"), Is.True); Assert.That(contentType.PropertyGroups.Any(x => x.IsDirty()), Is.True); } diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Models/ContentTypeTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Models/ContentTypeTests.cs index 00b2a3273a..b939eb15a5 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Models/ContentTypeTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Models/ContentTypeTests.cs @@ -170,7 +170,7 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Models clone.AddPropertyType(additionalPropertyType); Assert.IsTrue(asDirty.IsPropertyDirty("PropertyTypes")); Assert.IsFalse(asDirty.IsPropertyDirty("PropertyGroups")); - clone.AddPropertyGroup("hello"); + clone.AddPropertyGroup("hello", "hello"); Assert.IsTrue(asDirty.IsPropertyDirty("PropertyGroups")); } diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Services/ContentTypeServiceExtensionsTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Services/ContentTypeServiceExtensionsTests.cs index 12c7f93ff8..ca89009b6c 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/Services/ContentTypeServiceExtensionsTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/Services/ContentTypeServiceExtensionsTests.cs @@ -27,7 +27,12 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Services { new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext) { Alias = alias, Name = "Title", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 } }; - var pg = new PropertyGroup(contentCollection) { Name = "test", SortOrder = 1 }; + var pg = new PropertyGroup(contentCollection) + { + Alias = "test", + Name = "test", + SortOrder = 1 + }; ct.PropertyGroups.Add(pg); } @@ -67,7 +72,12 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Services { new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext) { Alias = "title", Name = "Title", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 } }; - var pg = new PropertyGroup(contentCollection) { Name = "test", SortOrder = 1 }; + var pg = new PropertyGroup(contentCollection) + { + Alias = "test", + Name = "test", + SortOrder = 1 + }; ct.PropertyGroups.Add(pg); } @@ -104,7 +114,12 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Services { new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext) { Alias = "title", Name = "Title", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88 } }; - var pg = new PropertyGroup(contentCollection) { Name = "test", SortOrder = 1 }; + var pg = new PropertyGroup(contentCollection) + { + Alias = "test", + Name = "test", + SortOrder = 1 + }; ct.PropertyGroups.Add(pg); } diff --git a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs index f9bdbe25ab..0f0a57c9eb 100644 --- a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs +++ b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs @@ -158,7 +158,12 @@ namespace Umbraco.Tests.TestHelpers.Entities contentCollection.Add(new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TinyMce, ValueStorageType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", Mandatory = false, SortOrder = 2, DataTypeId = -87 }); contentCollection.Add(new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext) { Alias = "author", Name = "Author", Description = "Name of the author", Mandatory = false, SortOrder = 3, DataTypeId = -88 }); - contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 }); + contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) + { + Name = "Content", + Alias = "content", + SortOrder = 1 + }); //ensure that nothing is marked as dirty contentType.ResetDirtyProperties(false); @@ -204,7 +209,11 @@ namespace Umbraco.Tests.TestHelpers.Entities contentCollection.Add(new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TinyMce, ValueStorageType.Ntext) { Alias = RandomAlias("bodyText", randomizeAliases), Name = "Body Text", Description = "", Mandatory = false, SortOrder = 2, DataTypeId = -87 }); contentCollection.Add(new PropertyType(ShortStringHelper, Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Ntext) { Alias = RandomAlias("author", randomizeAliases) , Name = "Author", Description = "Name of the author", Mandatory = false, SortOrder = 3, DataTypeId = -88 }); - var pg = new PropertyGroup(contentCollection) {Name = propertyGroupName, SortOrder = 1}; + var pg = new PropertyGroup(contentCollection) + { + Name = propertyGroupName, + SortOrder = 1 + }; contentType.PropertyGroups.Add(pg); //ensure that nothing is marked as dirty