public void GET_SET_Json() { JsonKey rk = "henry_json"; UserBase ub = new UserBase(); ub.Name = "henryfan"; ub.City = "gz"; ub.Counrty = "cn"; ub.Age = 10; rk.Set(ub); Assert.AreEqual(ub.Name, rk.Get<UserBase>().Name); }
public void GET_SET_Json_Objects() { JsonKey keys = new string[]{"henry_info", "henry_contact"}; UserBase ub = new UserBase(); ub.Name = "henryfan"; ub.City = "gz"; ub.Counrty = "cn"; ub.Age = 10; Contact contact = new Contact(); contact.EMail = "*****@*****.**"; contact.QQ = "28304340"; contact.Phone = "13660223497"; keys.SetValues(new object[] { ub, contact }); IList<object> data = keys.Get<UserBase, Contact>(); Assert.AreEqual(ub.Name, ((UserBase)data[0]).Name); Assert.AreEqual(contact.Phone, ((Contact)data[1]).Phone); }
public void GET_SET_Json_Objects() { JsonKey keys = new string[] { "henry_info", "henry_contact" }; UserBase ub = new UserBase(); ub.Name = "henryfan"; ub.City = "gz"; ub.Counrty = "cn"; ub.Age = 10; Contact contact = new Contact(); contact.EMail = "*****@*****.**"; contact.QQ = "28304340"; contact.Phone = "13660223497"; keys.SetValues(new object[] { ub, contact }); IList <object> data = keys.Get <UserBase, Contact>(); Assert.AreEqual(ub.Name, ((UserBase)data[0]).Name); Assert.AreEqual(contact.Phone, ((Contact)data[1]).Phone); }
public void MapSet() { JsonMapSet map = "HENRY_INFO"; UserBase ub = new UserBase(); ub.Name = "henryfan"; ub.City = "gz"; ub.Counrty = "cn"; ub.Age = 10; Contact contact = new Contact(); contact.EMail = "*****@*****.**"; contact.QQ = "28304340"; contact.Phone = "13660223497"; map.Set(ub, contact); IList <object> data = map.Get <UserBase, Contact>(); Assert.AreEqual(ub.Name, ((UserBase)data[0]).Name); Assert.AreEqual(contact.Phone, ((Contact)data[1]).Phone); }
public void GET_SET_Protobuf() { ProtobufKey rk = "henry_protobuf"; UserBase ub = new UserBase(); ub.Name = "henryfan"; ub.City = "gz"; ub.Counrty = "cn"; ub.Age = 10; rk.Set(ub); Assert.AreEqual(ub.Name, rk.Get<UserBase>().Name); }
public void MapSetClear() { JsonMapSet map = "HENRY_INFO"; UserBase ub = new UserBase(); ub.Name = "henryfan"; ub.City = "gz"; ub.Counrty = "cn"; ub.Age = 10; Contact contact = new Contact(); contact.EMail = "*****@*****.**"; contact.QQ = "28304340"; contact.Phone = "13660223497"; map.Set(ub, contact); map.Clear(); IList<object> data = map.Get<UserBase, Contact>(); Assert.AreEqual(null, data[0]); Assert.AreEqual(null, data[1]); }
public void MapSetdRemove() { JsonMapSet map = "HENRY_INFO"; UserBase ub = new UserBase(); ub.Name = "henryfan"; ub.City = "gz"; ub.Counrty = "cn"; ub.Age = 10; Contact contact = new Contact(); contact.EMail = "*****@*****.**"; contact.QQ = "28304340"; contact.Phone = "13660223497"; map.Set(ub, contact); map.Remove<Contact>(); contact = map.Get<Contact>(); Assert.AreEqual(null, contact); }