public void TestNullLogger() { LogDispatcher.LoggerFactory = null; var testee = new MyTestComponent(); testee.DoSomeLogging(); }
public void TestStreamFile() { MemoryStream memoryStream = new MemoryStream(); LogDispatcher.LoggerFactory = new StreamLoggerFactory(memoryStream); MyTestComponent test = new MyTestComponent(); test.DoSomeLogging(); // Open the file and check what is inside byte[] fsContent = new byte[memoryStream.Length]; memoryStream.Seek(0, SeekOrigin.Begin); memoryStream.Read(fsContent, 0, fsContent.Length); var fsText = Encoding.UTF8.GetString(fsContent, 0, fsContent.Length); Assert.StartsWith("An informative message", fsText); Assert.EndsWith("With exception context System.Exception: Something is not supported\r\n", fsText); }
public void TestStreamFile() { MyTestComponent test = new MyTestComponent(); test.DoSomeLogging(); // now close the logger LogDispatcher.LoggerFactory = null; // Open the file and check what is inside var fs = new FileStream(logFilePath, FileMode.Open, FileAccess.ReadWrite); byte[] fsContent = new byte[fs.Length]; fs.Read(fsContent, 0, fsContent.Length); fs.Dispose(); var fsText = Encoding.UTF8.GetString(fsContent, 0, fsContent.Length); Assert.StartsWith("An informative message", fsText); Assert.EndsWith("With exception context System.Exception: Something is not supported", fsText); }
public void TestMethodSerialDebug() { MyTestComponent test = new MyTestComponent(); test.DoSomeLogging(); }
public void TestDebugTest() { MyTestComponent test = new MyTestComponent(); test.DoSomeLogging(); }