public void MapUnexistPropertyException_Test() { ObjectConverter objectConverter = new ObjectConverter(); var target = new MapWithoutPropertyTestObject1_Copy(); target.Name = "QQ"; MapWithoutPropertyTestObject1 obj = new MapWithoutPropertyTestObject1(); objectConverter.MapObject(target, obj); Assert.AreEqual("QQ", obj.Name); Assert.AreEqual(100, obj.Age); }
public void MapUnexistProperty_Test() { ObjectConverter objectConverter = new ObjectConverter() { IsIgnoreNotExistingProperty = true, }; var target = new MapWithoutPropertyTestObject1_Copy(); target.Name = "QQ"; MapWithoutPropertyTestObject1 obj = new MapWithoutPropertyTestObject1(); objectConverter.MapObject(target, obj); Assert.AreEqual("QQ", obj.Name); Assert.AreEqual(100, obj.Age); }