public void TestErrorForLoggableWithFormat() { TestTarget.Current.Reset(); // run... var loggable = new TestLoggable(); loggable.LogError("Hello, {0}.", "**foo**"); // check... Assert.AreEqual(1, TestTarget.Current.NumWritten); Assert.AreEqual(LogLevel.Error, TestTarget.Current.LastWritten.Level); Assert.IsNull(TestTarget.Current.LastWritten.Exception); Assert.AreNotEqual(-1, TestTarget.Current.LastWritten.Message.IndexOf("**foo**")); }
public void TestErrorForLoggable() { TestTarget.Current.Reset(); // run... var loggable = new TestLoggable(); loggable.LogError("Hello, world."); // check... Assert.AreEqual(1, TestTarget.Current.NumWritten); Assert.AreEqual(LogLevel.Error, TestTarget.Current.LastWritten.Level); Assert.IsNull(TestTarget.Current.LastWritten.Exception); }
public void TestErrorForLoggableWithException() { TestTarget.Current.Reset(); // run... var loggable = new TestLoggable(); loggable.LogError("Hello, world", new InvalidOperationException("Foobar")); // check... Assert.AreEqual(1, TestTarget.Current.NumWritten); Assert.AreEqual(LogLevel.Error, TestTarget.Current.LastWritten.Level); Assert.IsNotNull(TestTarget.Current.LastWritten.Exception); }