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