Esempio n. 1
0
        public void LogWritesNewMessages()
        {
            string testMessage = "test message 1";

            Log.Write(Connection, testMessage, typeof(LogTest), DataLayer.MongoData.Config.LogLevelEnum.HeartError);

            DataLayerLog logRead = DataLayerLog.ReadLatest(Connection);

            Assert.AreEqual(testMessage, logRead.Message);
        }
Esempio n. 2
0
        public void LogDoesNotWriteDuplicateMessages()
        {
            string testMessage = "test message 1";

            Log.Write(Connection, testMessage, typeof(LogTest), DataLayer.MongoData.Config.LogLevelEnum.HeartError);
            DataLayerLog logRead1 = DataLayerLog.ReadLatest(Connection);

            Thread.Sleep(100);
            Log.Write(Connection, testMessage, typeof(LogTest), DataLayer.MongoData.Config.LogLevelEnum.HeartError);
            DataLayerLog logRead2 = DataLayerLog.ReadLatest(Connection);

            Assert.AreEqual(logRead1._id, logRead2._id);
        }
Esempio n. 3
0
        public void LogWritesDuplicateMessagesIfDelayIsLow()
        {
            string testMessage = "test message 1";

            Log.MaxSecondsToDiscardIdenticalLogMessages = 0;

            Log.Write(Connection, testMessage, typeof(LogTest), DataLayer.MongoData.Config.LogLevelEnum.HeartError);
            DataLayerLog logRead1 = DataLayerLog.ReadLatest(Connection);

            Thread.Sleep(100);
            Log.Write(Connection, testMessage, typeof(LogTest), DataLayer.MongoData.Config.LogLevelEnum.HeartError);
            DataLayerLog logRead2 = DataLayerLog.ReadLatest(Connection);

            Assert.AreNotEqual(logRead1._id, logRead2._id);
        }