public void ObjectToMapTest() { var obj = new obj { name = "ysj", age = 1, gender = genter.男 }; var dict = obj.ToMap(); var obj2 = dict.ToObject <obj>(); var obj3 = dict.ToObject(typeof(obj)); Assert.IsNotNull(obj2); Assert.IsNotNull(obj3); //Assert.Equals(obj, obj2); }
public void ObjectToMapTest() { var obj = new obj { name = "ysj", age = 1, gender = genter.男, Obj = new obj { name = "objname", age = 2, gender = genter.女 } }; var dict = obj.ToMap(); var obj2 = dict.ToObject <obj>(); var obj3 = dict.ToObject(typeof(obj)); Assert.IsNotNull(obj2); Assert.IsNotNull(obj3); Assert.IsNotNull(obj2.Obj); Assert.AreEqual(obj2.name, "ysj"); Assert.AreEqual(obj.Obj.name, "objname"); }