public void Test_Use_Method_to_Handle_Name_Collision_Priority() { var obj1 = new { Property1 = "value1", Property2 = "2" }; var obj2 = new { Property1 = "value2", Property3 = "3" }; var result1 = TypeMerger.Use(() => obj2.Property1) .Merge(obj1, obj2); result1.GetType().GetProperties().Length.Should().Be(3); result1.GetType().GetProperty("Property1").GetValue(result1).Should().Be("value2"); }
public void Test_Ignore_and_Use_Methods_used_in_Single_Merge_Policy() { var obj1 = new { Property1 = "value1", Property2 = "2" }; var obj2 = new { Property1 = "value2", Property3 = "3" }; var result = TypeMerger.Use(() => obj2.Property1) .Ignore(() => obj2.Property3) .Merge(obj1, obj2); result.GetType().GetProperties().Length.Should().Be(2); result.GetType().GetProperty("Property1").GetValue(result).Should().Be(obj2.Property1); result.GetType().GetProperty("Property2").GetValue(result).Should().Be(obj1.Property2); }