internal TraceLogger(TraceLogFactory _enclosing) { this._enclosing = _enclosing; }
public void TestTraceLogger() { var stream = new MemoryStream(); var listener = new TextWriterTraceListener(stream); Trace.Listeners.Add(listener); var logger = new TraceLogFactory().GetLogger("logger"); var logMsg = TestSupport.RandomString(); logger.Finest(logMsg); logger.Info(logMsg); logger.Warning(logMsg); logger.Severe(logMsg); listener.Flush(); stream.Seek(0, SeekOrigin.Begin); var log = new StreamReader(stream).ReadToEnd(); Assert.That(log, Is.StringContaining("Information: 0 : " + logMsg)); Assert.That(log, Is.StringContaining("Warning: 0 : " + logMsg)); Assert.That(log, Is.StringContaining("Error: 0 : " + logMsg)); }