annotate Implab.Test/UnitTest1.cs @ 258:d0876436d95d v3

missing file
author cin
date Fri, 13 Apr 2018 00:44:57 +0300
parents c52691faaf21
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
249
d82909310094 Implab.Test moved to xunit
cin
parents:
diff changeset
1 using System;
251
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 249
diff changeset
2 using System.Diagnostics;
249
d82909310094 Implab.Test moved to xunit
cin
parents:
diff changeset
3 using System.Threading;
252
6f4630d0bcd9 removed absolete Diagnostics classes
cin
parents: 251
diff changeset
4 using Implab.Diagnostics;
256
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
5 using System.Linq;
249
d82909310094 Implab.Test moved to xunit
cin
parents:
diff changeset
6 using Xunit;
d82909310094 Implab.Test moved to xunit
cin
parents:
diff changeset
7
253
34df34841225 Implab.Diagnostics drafts
cin
parents: 252
diff changeset
8 namespace Implab.Test {
34df34841225 Implab.Diagnostics drafts
cin
parents: 252
diff changeset
9 using System.Threading.Tasks;
252
6f4630d0bcd9 removed absolete Diagnostics classes
cin
parents: 251
diff changeset
10 using static Trace<UnitTest1>;
253
34df34841225 Implab.Diagnostics drafts
cin
parents: 252
diff changeset
11 public class UnitTest1 {
249
d82909310094 Implab.Test moved to xunit
cin
parents:
diff changeset
12 [Fact]
253
34df34841225 Implab.Diagnostics drafts
cin
parents: 252
diff changeset
13 public async Task Test1() {
34df34841225 Implab.Diagnostics drafts
cin
parents: 252
diff changeset
14 var listener = new SimpleTraceListener(Console.Out);
256
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
15 listener.TraceOutputOptions |= TraceOptions.ThreadId;
253
34df34841225 Implab.Diagnostics drafts
cin
parents: 252
diff changeset
16
252
6f4630d0bcd9 removed absolete Diagnostics classes
cin
parents: 251
diff changeset
17 var source = TraceSource;
6f4630d0bcd9 removed absolete Diagnostics classes
cin
parents: 251
diff changeset
18 source.Switch.Level = SourceLevels.All;
251
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 249
diff changeset
19
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 249
diff changeset
20 source.Listeners.Add(listener);
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 249
diff changeset
21
256
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
22 using (LogicalOperation("Test1")){
253
34df34841225 Implab.Diagnostics drafts
cin
parents: 252
diff changeset
23 await Task.Yield();
256
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
24 Log(String.Join(", ", Trace.CorrelationManager.LogicalOperationStack.Cast<object>().Select(x => x.ToString())));
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
25 await AsyncDummy();
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
26 Log(String.Join(", ", Trace.CorrelationManager.LogicalOperationStack.Cast<object>().Select(x => x.ToString())));
253
34df34841225 Implab.Diagnostics drafts
cin
parents: 252
diff changeset
27 }
249
d82909310094 Implab.Test moved to xunit
cin
parents:
diff changeset
28 }
256
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
29
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
30 async Task AsyncDummy() {
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
31 using(LogicalOperation("OuterDummy"))
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
32 using(LogicalOperation("InnerDummy")) {
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
33 Log(String.Join(", ", Trace.CorrelationManager.LogicalOperationStack.Cast<object>().Select(x => x.ToString())));
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
34 await Task.Delay(1);
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
35 Log(String.Join(", ", Trace.CorrelationManager.LogicalOperationStack.Cast<object>().Select(x => x.ToString())));
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
36 }
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
37 Log(String.Join(", ", Trace.CorrelationManager.LogicalOperationStack.Cast<object>().Select(x => x.ToString())));
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 253
diff changeset
38 }
249
d82909310094 Implab.Test moved to xunit
cin
parents:
diff changeset
39 }
d82909310094 Implab.Test moved to xunit
cin
parents:
diff changeset
40 }