Пример #1
0
 public void TestAnErrorBufferTraceListenerWithoutDefinedIn()
 {
     Trace.TraceWarning("Anything. More detail go here.");
     Trace.TraceError("something wrong; can you tell? more here.");
     Trace.WriteLine("This is writeline.", "Category");
     Trace.WriteLine("This is another writeline.", "caTegory");
     Trace.WriteLine("Writeline without right category", "CCCC");
     BufferedEmailTraceListener.SendAll();
     System.Threading.Thread.Sleep(5000);
 }
Пример #2
0
        public void BufferedSendOne()
        {
            var source = new TraceSource("bufferedEmailSource");

            BufferedEmailTraceListener.ClearAll();

//            source.TraceEvent(TraceEventType.Warning, 0, "Message 1 \u4E0D");
            source.TraceEvent(TraceEventType.Warning, 0, "Message 1");
            source.TraceEvent(TraceEventType.Error, 0, "Message 2");

            BufferedEmailTraceListener.SendAll();
            System.Threading.Thread.Sleep(2000);//need to wait, otherwise the test host is terminated resulting in thread abort.

            AssertMessagesSent(1);
        }