comparison Implab.Test/UnitTest1.cs @ 251:7c7e9ad6fe4a v3

Prerelease version of RunnableComponent Added draft messaging interfaces Added more more helpers to Xml/SerializationHelpers
author cin
date Sun, 11 Feb 2018 00:49:51 +0300
parents d82909310094
children 6f4630d0bcd9
comparison
equal deleted inserted replaced
250:9f63dade3a40 251:7c7e9ad6fe4a
1 using System; 1 using System;
2 using System.Diagnostics;
2 using System.Threading; 3 using System.Threading;
3 using Xunit; 4 using Xunit;
4 5
5 namespace Implab.Test 6 namespace Implab.Test
6 { 7 {
7 public class UnitTest1 8 public class UnitTest1
8 { 9 {
9 [Fact] 10 [Fact]
10 public void Test1() 11 public void Test1()
11 { 12 {
12 using(var cts = new CancellationTokenSource(1000)) { 13 var listener = new TextWriterTraceListener(Console.Out);
13 PromiseHelper.Sleep(10000, cts.Token).Join(); 14 var source = new TraceSource("Custom",SourceLevels.ActivityTracing);
14 } 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();
15 } 27 }
16 } 28 }
17 } 29 }