示例#1
0
        public void ShouldTraceErrorException()
        {
            var listener = new MockTraceListener();
            Trace.Listeners.Add(listener);

            var traceLogger = new TraceLogger();
            traceLogger.Log("Test exception message", Category.Exception, Priority.Low);

            Assert.AreEqual<string>("Test exception message", listener.ErrorMessage);

            Trace.Listeners.Remove(listener);
        }
示例#2
0
        public void ShouldWriteToTraceWriter()
        {
            var listener = new MockTraceListener();
            Trace.Listeners.Add(listener);

            var traceLogger = new TraceLogger();
            traceLogger.Log("Test debug message", Category.Debug, Priority.Low);

            Assert.AreEqual<string>("Test debug message", listener.LogMessage);

            Trace.Listeners.Remove(listener);
        }