Esempio n. 1
0
        public void Fatal_WhenCalled_LogsFatalLevel()
        {
            var writer = new MockLog();
            var logger = new Logger("test", writer);

            logger.Fatal("message");

            var item = writer.Items[0];
            Assert.AreEqual(Level.Fatal, item.Level);
        }
Esempio n. 2
0
        public void Info_WhenCalled_LogsInfoLevel()
        {
            var writer = new MockLog();
            var logger = new Logger("test", writer);

            logger.Info("message");

            var item = writer.Items[0];
            Assert.AreEqual(Level.Info, item.Level);
        }
Esempio n. 3
0
        public void Error_WhenCalled_LogsErrorLevel()
        {
            var writer = new MockLog();
            var logger = new Logger("test", writer);

            logger.Error("message");

            var item = writer.Items[0];
            Assert.AreEqual(Level.Error, item.Level);
        }
Esempio n. 4
0
        public void Debug_WhenCalled_LogsDebugLevel()
        {
            var writer = new MockLog();
            var logger = new Logger("test", writer);

            logger.Debug("message");

            var item = writer.Items[0];
            Assert.AreEqual(Level.Debug, item.Level);
        }
Esempio n. 5
0
        public void Write_WhenCalled_WritesItemIntoLog()
        {
            var log = new MockLog();
            var logService = new LogService(log);
            var item = Logger.CreateItem("logger name", Level.Trace, "message");

            logService.Write(item);

            Assert.AreEqual(item, log.Items[0]);
        }
Esempio n. 6
0
        public void Error_WithException_LogsException()
        {
            var writer = new MockLog();
            var logger = new Logger("test", writer);
            var exception = new ArgumentException("exception message");

            logger.Error(exception, "message");

            var item = writer.Items[0];
            Assert.AreEqual(exception, item.Exception);
        }
Esempio n. 7
0
        public void Warn_WhenCalled_LogsWarnLevel()
        {
            var writer = new MockLog();
            var logger = new Logger("test", writer);

            logger.Warn("message");

            var item = writer.Items[0];
            Assert.AreEqual(Level.Warn, item.Level);
        }
Esempio n. 8
0
        public void Trace_WhenCalled_LogsTraceLevel()
        {
            var writer = new MockLog();
            var logger = new Logger("test", writer);

            logger.Trace("message");

            var item = writer.Items[0];
            Assert.AreEqual(Level.Trace, item.Level);
        }
Esempio n. 9
0
        public void Trace_WhenCalled_LogsLoggerName()
        {
            var writer = new MockLog();
            const string loggerName = "test";
            var logger = new Logger(loggerName, writer);

            logger.Trace("message");

            var item = writer.Items[0];
            Assert.AreEqual("test", item.LoggerName);
        }