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

Commit

Permalink
MergeObjects test
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Apr 22, 2018
1 parent 573518c commit 1c919a3
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,22 @@ public class Employee
public string DisplayName { get; set; }
}

[Test]
public void Can_create_new_object_using_MergeIntoObjectDictionary()
{
var customer = new User { FirstName = "John", LastName = "Doe" };
var map = customer.MergeIntoObjectDictionary(new { Initial = "Z" });
map["DisplayName"] = map["FirstName"] + " " + map["Initial"] + " " + map["LastName"];
var employee = map.FromObjectDictionary<Employee>();

Assert.That(employee.DisplayName, Is.EqualTo("John Z Doe"));
}

[Test]
public void Can_create_new_object_from_merged_objects()
{
var customer = new User { FirstName = "John", LastName = "Doe" };
var map = customer.MergeIntoObjectDictionary(new {Initial = "Z"});
var map = MergeObjects(customer, new { Initial = "Z" });
map["DisplayName"] = map["FirstName"] + " " + map["Initial"] + " " + map["LastName"];
var employee = map.FromObjectDictionary<Employee>();

Expand Down

0 comments on commit 1c919a3

Please sign in to comment.