Fixes up some v7 failing tests.

This commit is contained in:
Shannon
2013-08-09 12:10:42 +10:00
parent 01510ce126
commit f4bd10065e
6 changed files with 15 additions and 4 deletions

View File

@@ -228,9 +228,9 @@ namespace Umbraco.Core.Models
/// <returns></returns>
public static IEnumerable<Property> GetNonGroupedProperties(this IContentBase content)
{
var propertyIdsInTabs = content.PropertyGroups.SelectMany(pg => pg.PropertyTypes).Select(pt => pt.Id);
var propertyIdsInTabs = content.PropertyGroups.SelectMany(pg => pg.PropertyTypes);
return content.Properties
.Where(property => propertyIdsInTabs.Contains(property.PropertyTypeId) == false)
.Where(property => propertyIdsInTabs.Contains(property.PropertyType) == false)
.OrderBy(x => x.PropertyType.SortOrder);
}

View File

@@ -75,7 +75,7 @@ namespace Umbraco.Core.Models
else
{
//NOTE: An exception will be thrown if this doesn't exist
var legacyDataType = property.PropertyType.DataType(property.Id, ApplicationContext.Current.Services.DataTypeService);
var legacyDataType = property.PropertyType.DataType(property.Id, dataTypeService);
//We've already got the value for the property so we're going to give it to the
// data type's data property so it doesn't go re-look up the value from the db again.

View File

@@ -42,7 +42,7 @@ namespace Umbraco.Tests
public void Get_All_Instances()
{
var factory = new umbraco.presentation.cache.Factory();
Assert.AreEqual(2, factory.GetAll().Count());
Assert.AreEqual(3, factory.GetAll().Count());
}
#region Classes for tests

View File

@@ -46,10 +46,13 @@ namespace Umbraco.Tests.Models
//add non-grouped properties
contentType.AddPropertyType(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) {Alias = "nonGrouped1", Name = "Non Grouped 1", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88});
contentType.AddPropertyType(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "nonGrouped2", Name = "Non Grouped 2", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 });
//ensure that nothing is marked as dirty
contentType.ResetDirtyProperties(false);
var content = MockedContent.CreateSimpleContent(contentType);
//need to id the p
var nonGrouped = content.GetNonGroupedProperties();

View File

@@ -4,7 +4,9 @@ using System.Xml;
using NUnit.Framework;
using Rhino.Mocks;
using Rhino.Mocks.Interfaces;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
using Umbraco.Core.Strings;
using Umbraco.Tests.TestHelpers;
@@ -19,6 +21,8 @@ namespace Umbraco.Tests.Models
protected override void FreezeResolution()
{
ShortStringHelperResolver.Current = new ShortStringHelperResolver(new DefaultShortStringHelper());
PropertyEditorResolver.Current = new PropertyEditorResolver(
() => PluginManager.Current.ResolvePropertyEditors());
base.FreezeResolution();
}

View File

@@ -18,6 +18,7 @@ using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Mappers;
using Umbraco.Core.Persistence.SqlSyntax;
using Umbraco.Core.Persistence.UnitOfWork;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Publishing;
using Umbraco.Core.Services;
using Umbraco.Tests.Stubs;
@@ -172,6 +173,9 @@ namespace Umbraco.Tests.TestHelpers
/// </summary>
protected override void FreezeResolution()
{
PropertyEditorResolver.Current = new PropertyEditorResolver(
() => PluginManager.Current.ResolvePropertyEditors());
DataTypesResolver.Current = new DataTypesResolver(
() => PluginManager.Current.ResolveDataTypes());