From 056d401133ee6b5eeb28328b666a37f3f709a712 Mon Sep 17 00:00:00 2001 From: Neil Dobson Date: Thu, 21 Feb 2019 20:25:00 +1100 Subject: [PATCH] Failing test --- .../AutoMappingObjectDictionaryTests.cs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/ServiceStack.Text.Tests/AutoMappingObjectDictionaryTests.cs b/tests/ServiceStack.Text.Tests/AutoMappingObjectDictionaryTests.cs index c90e3b2e3..b1032844f 100644 --- a/tests/ServiceStack.Text.Tests/AutoMappingObjectDictionaryTests.cs +++ b/tests/ServiceStack.Text.Tests/AutoMappingObjectDictionaryTests.cs @@ -130,6 +130,39 @@ public void Can_convert_from_ObjectDictionary_into_AutoQuery_DTO() Assert.That(request.Meta, Is.EquivalentTo(new Dictionary {{"foo", "bar"}})); } + public class PersonWithIdentities + { + public string Name { get; set; } + public List OtherNames { get;set; } + } + + public class OtherName + { + public string Name { get; set; } + } + + [Test] + public void Can_Convert_from_ObjectDictionary_Containing_Another_Object_Dictionary() + { + var map = new Dictionary + { + { "name", "Foo" }, + { "otherNames", new List + { + new Dictionary { { "name", "Fu" } }, + new Dictionary { { "name", "Fuey" } } + } + } + }; + + var fromDict = map.FromObjectDictionary(); + + Assert.AreEqual("Foo", fromDict.Name); + Assert.AreEqual(2, fromDict.OtherNames.Count); + Assert.AreEqual("Fu", fromDict.OtherNames.First().Name); + Assert.AreEqual("Fuey", fromDict.OtherNames.Last().Name); + } + public class Employee { public string FirstName { get; set; }