comparison Implab.Test/UnitTest1.cs @ 252:6f4630d0bcd9 v3

removed absolete Diagnostics classes
author cin
date Mon, 12 Feb 2018 07:24:31 +0300
parents 7c7e9ad6fe4a
children 34df34841225
comparison
equal deleted inserted replaced
251:7c7e9ad6fe4a 252:6f4630d0bcd9
1 using System; 1 using System;
2 using System.Diagnostics; 2 using System.Diagnostics;
3 using System.Threading; 3 using System.Threading;
4 using Implab.Diagnostics;
4 using Xunit; 5 using Xunit;
5 6
6 namespace Implab.Test 7 namespace Implab.Test
7 { 8 {
9 using static Trace<UnitTest1>;
8 public class UnitTest1 10 public class UnitTest1
9 { 11 {
10 [Fact] 12 [Fact]
11 public void Test1() 13 public void Test1()
12 { 14 {
13 var listener = new TextWriterTraceListener(Console.Out); 15 var listener = new TextWriterTraceListener(Console.Out);
14 var source = new TraceSource("Custom",SourceLevels.ActivityTracing); 16 var source = TraceSource;
17 source.Switch.Level = SourceLevels.All;
15 18
16 source.Listeners.Add(listener); 19 source.Listeners.Add(listener);
20 Trace.Listeners.Add(listener);
17 21
18 Trace.Listeners.Add(listener);
19 Trace.WriteLine("Hello!"); 22 Trace.WriteLine("Hello!");
20 Trace.CorrelationManager.StartLogicalOperation(); 23 StartLogicalOperation();
24
21 Trace.WriteLine("Inner"); 25 Trace.WriteLine("Inner");
22 foreach(var x in Trace.CorrelationManager.LogicalOperationStack) 26 foreach(var x in Trace.CorrelationManager.LogicalOperationStack)
23 Trace.WriteLine($"-{x}"); 27 Trace.WriteLine($"-{x}");
24 source.TraceEvent(TraceEventType.Information, 1, "source event"); 28 Log("source event");
29
30 listener.IndentLevel = 1;
31
25 source.TraceData(TraceEventType.Start, 1, DateTime.Now); 32 source.TraceData(TraceEventType.Start, 1, DateTime.Now);
26 Trace.CorrelationManager.StopLogicalOperation(); 33
34 StopLogicalOperation();
27 } 35 }
28 } 36 }
29 } 37 }