public async Task TestMethod2() { CompactLog log = new CompactLog(); await log.Add("文字{0}", new object[] { 1 }); Assert.AreEqual(1, log.EntryCount); var entry_create_time = log.GetEntry()[0].StartTime; log.WriteToLog((text) => { Assert.AreEqual(true, text.Contains("文字1")); }); // entry 的时间在 WriteToLog() 以后不会变 Assert.AreEqual(entry_create_time, log.GetEntry()[0].StartTime); log.RemoveEntry("文字{0}"); Assert.AreEqual(0, log.EntryCount); await log.Add("文字{0}", new object[] { 2 }); Assert.AreEqual(1, log.EntryCount); log.WriteToLog((text) => { Assert.AreEqual(false, text.Contains("文字1")); Assert.AreEqual(true, text.Contains("文字2")); }); }
public async Task TestMethod1() { CompactLog log = new CompactLog(); await log.Add("文字{0}", new object[] { 1 }); Assert.AreEqual(1, log.EntryCount); log.RemoveEntry("文字{0}"); Assert.AreEqual(0, log.EntryCount); }