public void GeneralSmsTest() { string sca = "8613800511500"; string t = "2011-05-29 10:53:20"; string p = "15050850677"; string c = "你好"; DecodedMessage dm = new DecodedMessage(0,sca, t, p, c); Assert.Equal(sca, dm.ServiceCenterAddress); Assert.Equal(t, dm.SendTime.ToString("yyyy-MM-dd HH:mm:ss")); Assert.Equal(p, dm.PhoneNumber); Assert.Equal(c, dm.SmsContent); }
public void NotCompletedLongSmsTest() { string head = "0201B2"; string sca = "8613800511500"; string t = "2011-05-20 21:30:59"; string p = "8615050850677"; string c = "GUDGKVBBgsscghjgdbgdfggrddswdh.kjhffyyhujko(;;((((((((())))))))))(;;..:,,((((((((((((.::...)))))))))))))....;;;;((((((((((((((;..:..;;((((.))))))))))))))"; DecodedMessage dm = new DecodedMessage(0,head,sca, t, p, c); Assert.Equal(sca, dm.ServiceCenterAddress); Assert.Equal(t, dm.SendTime.ToString("yyyy-MM-dd HH:mm:ss")); Assert.Equal(p, dm.PhoneNumber); Assert.Equal(c + "(...)", dm.SmsContent); }
/// <summary> /// 长短信合并 /// </summary> /// <param name="dm">被合并的短信</param> public void Add(DecodedMessage dm) { if (this.Flag != dm.Flag || dm.PhoneNumber != this.PhoneNumber) { throw new ArgumentException("不是本条的一部分"); } int current = dm.current; if (this.li.Contains(current)) { return; } this.SendTime = dm.SendTime; sd[current] = dm.sd[current]; }