Removing usage of IProfile on DataTypeDefinition.

Giving the Code First POC an extra kick in the conventions, so the default PropertyType convention can be overridden.
If a Definition doesn't exist for the selected DataType one will be created - with backing unit test.
This commit is contained in:
Morten Christensen
2012-11-24 19:07:06 -01:00
parent e32880f215
commit ff89383386
14 changed files with 240 additions and 121 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Configuration;
@@ -9,6 +10,7 @@ using Umbraco.Core.IO;
using Umbraco.Core.Models;
using Umbraco.Core.ObjectResolution;
using Umbraco.Core.Serialization;
using Umbraco.Tests.CodeFirst.Attributes;
using Umbraco.Tests.CodeFirst.Definitions;
using Umbraco.Tests.CodeFirst.TestModels;
using Umbraco.Tests.TestHelpers;
@@ -45,6 +47,21 @@ namespace Umbraco.Tests.CodeFirst
SerializationService = new SerializationService(serviceStackSerializer);
}
[Test]
public void Can_Create_Model_With_NonExisting_DataTypeDefinition()
{
ContentTypeDefinitionFactory.ClearContentTypeCache();
var modelType = typeof(ModelWithNewDataType);
var contentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(modelType);
var mappedContentTypes = ContentTypeDefinitionFactory.RetrieveMappedContentTypes();
ServiceContext.ContentTypeService.Save(mappedContentTypes);
var model = ServiceContext.ContentTypeService.GetContentType(1046);
Assert.That(model, Is.Not.Null);
}
[Test]
public void Can_Resolve_ContentType_From_Decorated_Home_Model()
{