Ejemplo n.º 1
0
        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);

        }
Ejemplo n.º 2
0
 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]);
 }
Ejemplo n.º 3
0
        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);

        }