public void SendsSingleMessage() { var counter = new UniqueLogThrottle(new TestConfiguration("foo")); var message = new UnityLogMessage("", "", LogType.Error); Assert.True(counter.ShouldSend(message)); }
public void ShouldNotSendDuplicateMessages() { var counter = new UniqueLogThrottle(new TestConfiguration("foo")); var message1 = new UnityLogMessage("", "", LogType.Error); var message2 = new UnityLogMessage("", "", LogType.Error); counter.ShouldSend(message1); Assert.False(counter.ShouldSend(message2)); }
public void FlushesCorrectly() { var configuration = new TestConfiguration("foo"); var counter = new UniqueLogThrottle(configuration); var message = new UnityLogMessage("", "", LogType.Error); counter.ShouldSend(message); Thread.Sleep(configuration.UniqueLogsTimePeriod); message = new UnityLogMessage("", "", LogType.Error); Assert.True(counter.ShouldSend(message)); }