Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 1c919a3

Browse files
committed
MergeObjects test
1 parent 573518c commit 1c919a3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/ServiceStack.Text.Tests/AutoMappingObjectDictionaryTests.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,22 @@ public class Employee
134134
public string DisplayName { get; set; }
135135
}
136136

137+
[Test]
138+
public void Can_create_new_object_using_MergeIntoObjectDictionary()
139+
{
140+
var customer = new User { FirstName = "John", LastName = "Doe" };
141+
var map = customer.MergeIntoObjectDictionary(new { Initial = "Z" });
142+
map["DisplayName"] = map["FirstName"] + " " + map["Initial"] + " " + map["LastName"];
143+
var employee = map.FromObjectDictionary<Employee>();
144+
145+
Assert.That(employee.DisplayName, Is.EqualTo("John Z Doe"));
146+
}
147+
137148
[Test]
138149
public void Can_create_new_object_from_merged_objects()
139150
{
140151
var customer = new User { FirstName = "John", LastName = "Doe" };
141-
var map = customer.MergeIntoObjectDictionary(new {Initial = "Z"});
152+
var map = MergeObjects(customer, new { Initial = "Z" });
142153
map["DisplayName"] = map["FirstName"] + " " + map["Initial"] + " " + map["LastName"];
143154
var employee = map.FromObjectDictionary<Employee>();
144155

0 commit comments

Comments
 (0)