public void Test_DailyLog() { Assert.IsFalse(Directory.Exists(TestPath)); LoggingStack.UseDailyLog(TestLog); LoggingStack.GetLog().Error(new Exception(), "Some exception"); Assert.IsTrue(File.Exists(TestLog), "Log should be created"); }
public void Test_RollingLog() { Assert.IsFalse(File.Exists(TestLog), "File should not exist before test"); LoggingStack.UseRollingLog(TestLog, 10.Mb(), 10); LoggingStack.GetLog().Error(new Exception(), "Test"); Assert.IsTrue(File.Exists(TestLog), "Log should be created"); }
public void Test_ConsoleLog() { using (var writer = new StringWriter()) { Console.SetOut(writer); LoggingStack.UseConsoleLog(); LoggingStack.GetLog().Error(new Exception(), "Some exception"); Enforce.That(writer.ToString(), StringIs.NotEmpty); } }