From caf41b74b8fcacc575c274a9163be58cdef5c846 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 1 May 2014 12:26:18 +0200 Subject: [PATCH] Add failing test - dictionary items don't get properly nested --- .../Services/Importing/PackageImportTests.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/Umbraco.Tests/Services/Importing/PackageImportTests.cs b/src/Umbraco.Tests/Services/Importing/PackageImportTests.cs index e920a4e34f..4a318f4603 100644 --- a/src/Umbraco.Tests/Services/Importing/PackageImportTests.cs +++ b/src/Umbraco.Tests/Services/Importing/PackageImportTests.cs @@ -402,6 +402,32 @@ namespace Umbraco.Tests.Services.Importing AssertDictionaryItem("Child", expectedNorwegianChildValue, "nb-NO"); } + [Test] + public void PackagingService_Can_Import_Nested_DictionaryItems() + { + // Arrange + const string parentKey = "Parent"; + const string childKey = "Child"; + + var newPackageXml = XElement.Parse(ImportResources.Dictionary_Package); + var dictionaryItemsElement = newPackageXml.Elements("DictionaryItems").First(); + + AddLanguages(); + + // Act + ServiceContext.PackagingService.ImportDictionaryItems(dictionaryItemsElement); + + // Assert + Assert.That(ServiceContext.LocalizationService.DictionaryItemExists(parentKey), "DictionaryItem parentKey does not exist"); + Assert.That(ServiceContext.LocalizationService.DictionaryItemExists(childKey), "DictionaryItem childKey does not exist"); + + var parentDictionaryItem = ServiceContext.LocalizationService.GetDictionaryItemByKey(parentKey); + var childDictionaryItem = ServiceContext.LocalizationService.GetDictionaryItemByKey(childKey); + + Assert.That(parentDictionaryItem.ParentId, Is.Not.EqualTo(childDictionaryItem.ParentId)); + Assert.That(childDictionaryItem.ParentId, Is.EqualTo(parentDictionaryItem.Id)); + } + [Test] public void PackagingService_WhenExistingDictionaryKey_ImportsNewChildren() {