249
|
1 using System;
|
251
|
2 using System.Diagnostics;
|
249
|
3 using System.Threading;
|
252
|
4 using Implab.Diagnostics;
|
249
|
5 using Xunit;
|
|
6
|
253
|
7 namespace Implab.Test {
|
|
8 using System.Threading.Tasks;
|
252
|
9 using static Trace<UnitTest1>;
|
253
|
10 public class UnitTest1 {
|
249
|
11 [Fact]
|
253
|
12 public async Task Test1() {
|
|
13 var listener = new SimpleTraceListener(Console.Out);
|
|
14
|
252
|
15 var source = TraceSource;
|
|
16 source.Switch.Level = SourceLevels.All;
|
251
|
17
|
|
18 source.Listeners.Add(listener);
|
|
19
|
253
|
20 using (var op = LogicalOperation(nameof(Test1)))
|
|
21 using (LogicalOperation("InnerOperation")){
|
|
22 await Task.Yield();
|
|
23 Log("Inner");
|
|
24 await Task.Yield();
|
|
25 Log("source event");
|
|
26 }
|
249
|
27 }
|
|
28 }
|
|
29 }
|