Пример #1
0
        public void Write_WithNullException_WritesEmptyExceptionString()
        {
            var itemWithNullException = Logger.CreateItem("name", Level.Error, "message", exception: null);
            var log = new MockLineLog();

            log.Write(itemWithNullException);

            Assert.AreEqual(string.Empty, log.LastExceptionAsString);
        }
Пример #2
0
        public void Write_WithException_WritesSpacebarBeforeExceptionMessage()
        {
            var itemWithException = Logger.CreateItem("name", Level.Error, "message", exception: new Exception("exception"));
            var log = new MockLineLog();

            log.Write(itemWithException);

            Assert.AreEqual(" System.Exception: exception", log.LastExceptionAsString);
        }
Пример #3
0
        public void Write_WithFormatAndArgs_FormatsMessage()
        {
            const string format = "message {0} {1}";
            var args = new object[] { 1, 2 };
            var itemWithFormatAndArgs = Logger.CreateItem("name", Level.Trace, format, args);
            var log = new MockLineLog();

            log.Write(itemWithFormatAndArgs);

            Assert.AreEqual("message 1 2", log.LastMessage);
        }