/// <summary> /// Clears ID filter. All the entries will be logged. /// </summary> public static void FilterClear() { lock (sync) { if (!init) { InitBody(); } collector.FilterClear(); } }
public void FilterClearTest() { LogItem message = new LogItem(category, level, msg, ids, GetException()); var qThread = new Mock<IQueued<LogItem>>(MockBehavior.Strict); var writer = new Mock<ILogWriter>(MockBehavior.Strict); writer .Setup(s => s.Write(It.IsAny<LogItem>())); writer .Setup(s => s.GetTimeout()) .Returns(timeout); qThread .Setup(s => s.SetTimeout(It.IsAny<int>())); LogCollector target = new LogCollector(qThread.Object, writer.Object); target.FilterAddID(1); qThread.Raise(s => s.OnReceive += null, message); writer .Verify(s => s.Write(It.IsAny<LogItem>()), Times.Never()); target.FilterClear(); qThread.Raise(s => s.OnReceive += null, message); writer .Verify(s => s.Write(It.Is<LogItem>(a => a.Equals(message))), Times.Once()); }