System.Diagnostics.TraceSourceTests.CorrelationManagerTests.CorrelationManager_CorrelationAcrossAwait C# (CSharp) Method

CorrelationManager_CorrelationAcrossAwait() private method

private CorrelationManager_CorrelationAcrossAwait ( ) : Task
return Task
        public async Task CorrelationManager_CorrelationAcrossAwait()
        {
            Guid g = Guid.NewGuid();
            Trace.CorrelationManager.ActivityId = g;


            Assert.Equal(g, Trace.CorrelationManager.ActivityId);
            Trace.CorrelationManager.StartLogicalOperation("one");

            // 1 operation in progress
            ValidateStack(Trace.CorrelationManager.LogicalOperationStack, "one");
            Trace.CorrelationManager.StartLogicalOperation("two");
            await Task.Yield();

            // 2 operations in progress
            ValidateStack(Trace.CorrelationManager.LogicalOperationStack, "two", "one");
            Trace.CorrelationManager.StopLogicalOperation();
            ValidateStack(Trace.CorrelationManager.LogicalOperationStack, "one");

            await Task.Delay(1);
            Trace.CorrelationManager.StopLogicalOperation();
            ValidateStack(Trace.CorrelationManager.LogicalOperationStack);
        }