Fixing up more unit tests - still a bunch more to do
This commit is contained in:
@@ -207,7 +207,7 @@ namespace Umbraco.Core
|
||||
if (destinationType == typeof(Boolean))
|
||||
return Attempt<object>.Succeed(false); // special case for booleans, null/empty == false
|
||||
else if (destinationType == typeof(DateTime))
|
||||
return Attempt<object>.Succeed(DateTime.MinValue);
|
||||
return Attempt<object>.Succeed(false);
|
||||
}
|
||||
|
||||
// we have a non-empty string, look for type conversions in the expected order of frequency of use...
|
||||
|
||||
@@ -191,7 +191,8 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
.Select("DISTINCT cmsTags.*")
|
||||
.From<TagDto>()
|
||||
.InnerJoin<TagRelationshipDto>()
|
||||
.On<TagRelationshipDto, TagDto>(left => left.TagId, right => right.Id);
|
||||
.On<TagRelationshipDto, TagDto>(left => left.TagId, right => right.Id)
|
||||
.Where<TagRelationshipDto>(dto => dto.NodeId == contentId);
|
||||
|
||||
if (group.IsNullOrWhiteSpace() == false)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.Models.Mapping;
|
||||
using umbraco;
|
||||
|
||||
namespace Umbraco.Tests.Models.Mapping
|
||||
{
|
||||
@@ -112,7 +113,7 @@ namespace Umbraco.Tests.Models.Mapping
|
||||
AssertDisplayProperty(result, p, ApplicationContext);
|
||||
}
|
||||
Assert.AreEqual(content.PropertyGroups.Count(), result.Tabs.Count() - 1);
|
||||
Assert.IsTrue(result.Tabs.Any(x => x.Label == "Generic properties"));
|
||||
Assert.IsTrue(result.Tabs.Any(x => x.Label == ui.Text("general", "properties")));
|
||||
Assert.IsTrue(result.Tabs.First().IsActive);
|
||||
Assert.IsTrue(result.Tabs.Except(new[] {result.Tabs.First()}).All(x => x.IsActive == false));
|
||||
}
|
||||
@@ -158,8 +159,8 @@ namespace Umbraco.Tests.Models.Mapping
|
||||
AssertDisplayProperty(result, p, ApplicationContext);
|
||||
}
|
||||
Assert.AreEqual(content.PropertyGroups.Count(), result.Tabs.Count() - 1);
|
||||
Assert.IsTrue(result.Tabs.Any(x => x.Label == "Generic properties"));
|
||||
Assert.AreEqual(2, result.Tabs.Where(x => x.Label == "Generic properties").SelectMany(x => x.Properties.Where(p => p.Alias.StartsWith("_umb_") == false)).Count());
|
||||
Assert.IsTrue(result.Tabs.Any(x => x.Label == ui.Text("general", "properties")));
|
||||
Assert.AreEqual(2, result.Tabs.Where(x => x.Label == ui.Text("general", "properties")).SelectMany(x => x.Properties.Where(p => p.Alias.StartsWith("_umb_") == false)).Count());
|
||||
}
|
||||
|
||||
#region Assertions
|
||||
|
||||
@@ -481,6 +481,11 @@ namespace Umbraco.Tests.Persistence
|
||||
using (Transaction transaction = Database.GetTransaction())
|
||||
{
|
||||
Database.CreateTable<NodeDto>();
|
||||
Database.CreateTable<ContentDto>();
|
||||
Database.CreateTable<ContentTypeDto>();
|
||||
Database.CreateTable<DataTypeDto>();
|
||||
Database.CreateTable<PropertyTypeGroupDto>();
|
||||
Database.CreateTable<PropertyTypeDto>();
|
||||
Database.CreateTable<TagDto>();
|
||||
Database.CreateTable<TagRelationshipDto>();
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
Assert.That(dataTypeDefinitions, Is.Not.Null);
|
||||
Assert.That(dataTypeDefinitions.Any(), Is.True);
|
||||
Assert.That(dataTypeDefinitions.Any(x => x == null), Is.False);
|
||||
Assert.That(dataTypeDefinitions.Count(), Is.EqualTo(24));
|
||||
Assert.That(dataTypeDefinitions.Count(), Is.EqualTo(20));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
{
|
||||
|
||||
// Act
|
||||
var exists = repository.Exists(1042); //Macro Container
|
||||
var exists = repository.Exists(1034); //Content picker
|
||||
var doesntExist = repository.Exists(-80);
|
||||
|
||||
// Assert
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Umbraco.Tests.PropertyEditors
|
||||
{
|
||||
LegacyPropertyEditorIdToAliasConverter.CreateMappingsForCoreEditors();
|
||||
|
||||
Assert.AreEqual(36, LegacyPropertyEditorIdToAliasConverter.Count());
|
||||
Assert.AreEqual(37, LegacyPropertyEditorIdToAliasConverter.Count());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,11 +113,11 @@ namespace Umbraco.Tests.Services
|
||||
contentTypeService.Save(contentType);
|
||||
var content = MockedContent.CreateSimpleContent(contentType, "Tagged content", 1046);
|
||||
content.SetTags("tags", new[] { "hello", "world", "some", "tags" }, true);
|
||||
contentService.Publish(content);
|
||||
contentService.PublishWithStatus(content);
|
||||
|
||||
// Act
|
||||
content.SetTags("tags", new[] { "another", "world" }, false);
|
||||
contentService.Publish(content);
|
||||
contentService.PublishWithStatus(content);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(5, content.Properties["tags"].Value.ToString().Split(',').Distinct().Count());
|
||||
@@ -143,11 +143,11 @@ namespace Umbraco.Tests.Services
|
||||
contentTypeService.Save(contentType);
|
||||
var content = MockedContent.CreateSimpleContent(contentType, "Tagged content", 1046);
|
||||
content.SetTags("tags", new[] { "hello", "world", "some", "tags" }, true);
|
||||
contentService.Publish(content);
|
||||
contentService.PublishWithStatus(content);
|
||||
|
||||
// Act
|
||||
content.RemoveTags("tags", new[] { "some", "world" });
|
||||
contentService.Publish(content);
|
||||
contentService.PublishWithStatus(content);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(2, content.Properties["tags"].Value.ToString().Split(',').Distinct().Count());
|
||||
|
||||
Reference in New Issue
Block a user