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