jxdiscuz 发表于 2018-11-7 09:10:40

Redis For .NET开源组件Beetle.Redis-ikende .net组件库

  
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).Name);
  Assert.AreEqual(contact.Phone, ((Contact)data).Phone);
  
}
  

  
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);
  
}
  

  
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);
  Assert.AreEqual(null, data);
  
}


页: [1]
查看完整版本: Redis For .NET开源组件Beetle.Redis-ikende .net组件库