##// END OF EJS Templates
missing file
missing file

File last commit:

r256:c52691faaf21 v3
r258:d0876436d95d v3
Show More
UnitTest1.cs
40 lines | 1.6 KiB | text/x-csharp | CSharpLexer
using System;
using System.Diagnostics;
using System.Threading;
using Implab.Diagnostics;
using System.Linq;
using Xunit;
namespace Implab.Test {
using System.Threading.Tasks;
using static Trace<UnitTest1>;
public class UnitTest1 {
[Fact]
public async Task Test1() {
var listener = new SimpleTraceListener(Console.Out);
listener.TraceOutputOptions |= TraceOptions.ThreadId;
var source = TraceSource;
source.Switch.Level = SourceLevels.All;
source.Listeners.Add(listener);
using (LogicalOperation("Test1")){
await Task.Yield();
Log(String.Join(", ", Trace.CorrelationManager.LogicalOperationStack.Cast<object>().Select(x => x.ToString())));
await AsyncDummy();
Log(String.Join(", ", Trace.CorrelationManager.LogicalOperationStack.Cast<object>().Select(x => x.ToString())));
}
}
async Task AsyncDummy() {
using(LogicalOperation("OuterDummy"))
using(LogicalOperation("InnerDummy")) {
Log(String.Join(", ", Trace.CorrelationManager.LogicalOperationStack.Cast<object>().Select(x => x.ToString())));
await Task.Delay(1);
Log(String.Join(", ", Trace.CorrelationManager.LogicalOperationStack.Cast<object>().Select(x => x.ToString())));
}
Log(String.Join(", ", Trace.CorrelationManager.LogicalOperationStack.Cast<object>().Select(x => x.ToString())));
}
}
}