void LoadNumber() { List <string> phones = BlacklistDB.GetNumbers(); foreach (var phone in phones) { if (!ContainsNumber(phone)) { numbers.Add(phone); } } }
public RPCResult <List <string> > GetBlacklist() { try { List <string> list = BlacklistDB.GetNumbers(); return(new RPCResult <List <string> >(true, list, "")); } catch (Exception ex) { LogHelper.LogError("SMSService", "SMSService.GetBlacklist", ex.ToString()); return(new RPCResult <List <string> >(false, null, "获取黑名单失败")); } }
public void Test() { List <string> black = new List <string>() { "123456", "234567", "345678" }; var b = BlacklistDB.Add(black); Assert.IsTrue(b); var list = BlacklistDB.GetNumbers(); Assert.IsNotNull(list); Assert.IsTrue(list.Contains("123456")); Assert.IsTrue(list.Contains("234567")); Assert.IsTrue(list.Contains("345678")); b = BlacklistDB.Del(black); list = BlacklistDB.GetNumbers(); Assert.IsNotNull(list); Assert.IsTrue(!list.Contains("123456")); Assert.IsTrue(!list.Contains("234567")); Assert.IsTrue(!list.Contains("345678")); }