diff --git a/src/Umbraco.Core/Persistence/Querying/SqlTranslator.cs b/src/Umbraco.Core/Persistence/Querying/SqlTranslator.cs
index a99be90cd3..ef5e14a019 100644
--- a/src/Umbraco.Core/Persistence/Querying/SqlTranslator.cs
+++ b/src/Umbraco.Core/Persistence/Querying/SqlTranslator.cs
@@ -3,10 +3,10 @@
namespace Umbraco.Core.Persistence.Querying
{
///
- /// Represents the Sql Translator for translating a object to Sql
+ /// Represents the Sql Translator for translating a IQuery object to Sql
///
///
- public class SqlTranslator
+ internal class SqlTranslator
{
private readonly Sql _sql;
diff --git a/src/Umbraco.Tests/LegacyApi/MediaTypeTests.cs b/src/Umbraco.Tests/LegacyApi/MediaTypeTests.cs
new file mode 100644
index 0000000000..f3be9d6006
--- /dev/null
+++ b/src/Umbraco.Tests/LegacyApi/MediaTypeTests.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Linq;
+using NUnit.Framework;
+using Umbraco.Tests.TestHelpers;
+using Umbraco.Tests.TestHelpers.Entities;
+using umbraco.cms.businesslogic.media;
+
+namespace Umbraco.Tests.LegacyApi
+{
+ [TestFixture]
+ public class MediaTypeTests : BaseDatabaseFactoryTest
+ {
+ [SetUp]
+ public override void Initialize()
+ {
+ base.Initialize();
+
+ CreateTestData();
+ }
+
+ [Test]
+ public void Can_Verify_AllowedChildContentTypes_On_MediaType()
+ {
+ // Arrange
+ var folder = MediaType.GetByAlias("Folder");
+ var folderStructure = folder.AllowedChildContentTypeIDs.ToList();
+ folderStructure.Add(1045);
+
+ // Act
+ folder.AllowedChildContentTypeIDs = folderStructure.ToArray();
+ folder.Save();
+
+ // Assert
+ var updated = MediaType.GetByAlias("Folder");
+
+ Assert.That(updated.AllowedChildContentTypeIDs.Any(), Is.True);
+ Assert.That(updated.AllowedChildContentTypeIDs.Any(x => x == 1045), Is.True);
+ }
+
+ public void CreateTestData()
+ {
+ //Create and Save ContentType "video" -> 1045
+ var videoMediaType = MockedContentTypes.CreateVideoMediaType();
+ ServiceContext.ContentTypeService.Save(videoMediaType);
+ }
+
+
+ [TearDown]
+ public override void TearDown()
+ {
+ base.TearDown();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs
index 9948282c10..0ec1fd5dd0 100644
--- a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs
+++ b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Umbraco.Core.Models;
@@ -227,6 +228,48 @@ namespace Umbraco.Tests.Persistence.Repositories
Assert.That(contentType.PropertyGroups.Count(), Is.EqualTo(2));
}
+ [Test]
+ public void Can_Verify_AllowedChildContentTypes_On_ContentType()
+ {
+ // Arrange
+ var provider = new PetaPocoUnitOfWorkProvider();
+ var unitOfWork = provider.GetUnitOfWork();
+ var repository = RepositoryResolver.Current.ResolveByType(unitOfWork);
+
+ var subpageContentType = MockedContentTypes.CreateSimpleContentType("umbSubpage", "Subpage");
+ var simpleSubpageContentType = MockedContentTypes.CreateSimpleContentType("umbSimpleSubpage", "Simple Subpage");
+ repository.AddOrUpdate(subpageContentType);
+ repository.AddOrUpdate(simpleSubpageContentType);
+ unitOfWork.Commit();
+
+ // Act
+ var contentType = repository.Get(1045);
+ contentType.AllowedContentTypes = new List
+ {
+ new ContentTypeSort
+ {
+ Alias = subpageContentType.Alias,
+ Id = new Lazy(() => subpageContentType.Id),
+ SortOrder = 0
+ },
+ new ContentTypeSort
+ {
+ Alias = simpleSubpageContentType.Alias,
+ Id = new Lazy(() => simpleSubpageContentType.Id),
+ SortOrder = 1
+ }
+ };
+ repository.AddOrUpdate(contentType);
+ unitOfWork.Commit();
+
+ //Assert
+ var updated = repository.Get(1045);
+
+ Assert.That(updated.AllowedContentTypes.Any(), Is.True);
+ Assert.That(updated.AllowedContentTypes.Any(x => x.Alias == subpageContentType.Alias), Is.True);
+ Assert.That(updated.AllowedContentTypes.Any(x => x.Alias == simpleSubpageContentType.Alias), Is.True);
+ }
+
public void CreateTestData()
{
//Create and Save ContentType "umbTextpage" -> 1045
diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj
index b999aeeb16..8e2d1e3b44 100644
--- a/src/Umbraco.Tests/Umbraco.Tests.csproj
+++ b/src/Umbraco.Tests/Umbraco.Tests.csproj
@@ -158,6 +158,7 @@
+