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); }
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**")); }
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); }