Example #1
0
        public void TestTraceForLoggableWithException()
        {
            TestTarget.Current.Reset();

            // run...
            var loggable = new TestLoggable();
            loggable.Trace("Hello, world.", new InvalidOperationException("Foobar"));

            // check...
            Assert.AreEqual(1, TestTarget.Current.NumWritten);
            Assert.AreEqual(LogLevel.Trace, TestTarget.Current.LastWritten.Level);
            Assert.IsNotNull(TestTarget.Current.LastWritten.Exception);
        }
Example #2
0
        public void TestTraceForLoggableWithFormat()
        {
            TestTarget.Current.Reset();

            // run...
            var loggable = new TestLoggable();
            loggable.Trace("Hello, {0}.", "**foo**");

            // check...
            Assert.AreEqual(1, TestTarget.Current.NumWritten);
            Assert.AreEqual(LogLevel.Trace, TestTarget.Current.LastWritten.Level);
            Assert.IsNull(TestTarget.Current.LastWritten.Exception);
            Assert.AreNotEqual(-1, TestTarget.Current.LastWritten.Message.IndexOf("**foo**"));
        }
Example #3
0
        public void TestTraceForLoggable()
        {
            TestTarget.Current.Reset();

            // run...
            var loggable = new TestLoggable();
            loggable.Trace("Hello, world.");

            // check...
            Assert.AreEqual(1, TestTarget.Current.NumWritten);
            Assert.AreEqual(LogLevel.Trace, TestTarget.Current.LastWritten.Level);
            Assert.IsNull(TestTarget.Current.LastWritten.Exception);
        }