|
[TestMethod]
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 = "hernyfan@msn.com";
contact.QQ = "28304340";
contact.Phone = "13660223497";
map.Set(ub, contact);
IList data = map.Get();
Assert.AreEqual(ub.Name, ((UserBase)data[0]).Name);
Assert.AreEqual(contact.Phone, ((Contact)data[1]).Phone);
}
[TestMethod]
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 = "hernyfan@msn.com";
contact.QQ = "28304340";
contact.Phone = "13660223497";
map.Set(ub, contact);
map.Remove();
contact = map.Get();
Assert.AreEqual(null, contact);
}
[TestMethod]
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 = "hernyfan@msn.com";
contact.QQ = "28304340";
contact.Phone = "13660223497";
map.Set(ub, contact);
map.Clear();
IList data = map.Get();
Assert.AreEqual(null, data[0]);
Assert.AreEqual(null, data[1]);
}
|
|
|