private async Task YieldTwoActivitiesDeep(ActivityEventSource es) { Assert.Equal(Guid.Empty, EventSource.CurrentThreadActivityId); es.ExampleStart(); es.Example2Start(); await Task.Yield(); es.Example2Stop(); es.ExampleStop(); Assert.Equal(Guid.Empty, EventSource.CurrentThreadActivityId); }
public void StartStopCreatesActivity() { using ActivityEventListener l = new ActivityEventListener(); using ActivityEventSource es = new ActivityEventSource(); Assert.Equal(Guid.Empty, EventSource.CurrentThreadActivityId); es.ExampleStart(); Assert.NotEqual(Guid.Empty, EventSource.CurrentThreadActivityId); es.ExampleStop(); Assert.Equal(Guid.Empty, EventSource.CurrentThreadActivityId); }
public async Task ActivityFlowsAsync() { using ActivityEventListener l = new ActivityEventListener(); using ActivityEventSource es = new ActivityEventSource(); Assert.Equal(Guid.Empty, EventSource.CurrentThreadActivityId); es.ExampleStart(); Assert.NotEqual(Guid.Empty, EventSource.CurrentThreadActivityId); await Task.Yield(); Assert.NotEqual(Guid.Empty, EventSource.CurrentThreadActivityId); es.ExampleStop(); Assert.Equal(Guid.Empty, EventSource.CurrentThreadActivityId); }
public async Task SetCurrentActivityIdBeforeEventFlowsAsync() { using ActivityEventListener l = new ActivityEventListener(); using ActivityEventSource es = new ActivityEventSource(); try { Guid g = Guid.NewGuid(); EventSource.SetCurrentThreadActivityId(g); Assert.Equal(g, EventSource.CurrentThreadActivityId); es.ExampleStart(); await Task.Yield(); es.ExampleStop(); Assert.Equal(g, EventSource.CurrentThreadActivityId); } finally { EventSource.SetCurrentThreadActivityId(Guid.Empty); } }