249
|
1 using System;
|
251
|
2 using System.Diagnostics;
|
249
|
3 using System.Threading;
|
|
4 using Xunit;
|
|
5
|
|
6 namespace Implab.Test
|
|
7 {
|
|
8 public class UnitTest1
|
|
9 {
|
|
10 [Fact]
|
|
11 public void Test1()
|
|
12 {
|
251
|
13 var listener = new TextWriterTraceListener(Console.Out);
|
|
14 var source = new TraceSource("Custom",SourceLevels.ActivityTracing);
|
|
15
|
|
16 source.Listeners.Add(listener);
|
|
17
|
|
18 Trace.Listeners.Add(listener);
|
|
19 Trace.WriteLine("Hello!");
|
|
20 Trace.CorrelationManager.StartLogicalOperation();
|
|
21 Trace.WriteLine("Inner");
|
|
22 foreach(var x in Trace.CorrelationManager.LogicalOperationStack)
|
|
23 Trace.WriteLine($"-{x}");
|
|
24 source.TraceEvent(TraceEventType.Information, 1, "source event");
|
|
25 source.TraceData(TraceEventType.Start, 1, DateTime.Now);
|
|
26 Trace.CorrelationManager.StopLogicalOperation();
|
249
|
27 }
|
|
28 }
|
|
29 }
|