Example #1
0
        public void SendsSingleMessage()
        {
            var counter = new UniqueLogThrottle(new TestConfiguration("foo"));

            var message = new UnityLogMessage("", "", LogType.Error);

            Assert.True(counter.ShouldSend(message));
        }
Example #2
0
        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));
        }
Example #3
0
        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));
        }