public void CannotInterleaveActivityIds() { var activityId = Guid.NewGuid(); var traceSource = new TraceSource(MethodBase.GetCurrentMethod().Name, SourceLevels.All); var context = new ActivityScope(traceSource, activityId); Trace.CorrelationManager.ActivityId = Guid.NewGuid(); var ex = Assert.Throws <InvalidOperationException>(() => context.Dispose()); Assert.Equal(Exceptions.ActivityIdModifiedInsideScope, ex.Message); Trace.CorrelationManager.ActivityId = activityId; context.Dispose(); }
public void CanDisposeRepeatedly() { var traceSource = new TraceSource(MethodBase.GetCurrentMethod().Name, SourceLevels.All); using (var context = new ActivityScope(traceSource, Guid.Empty)) context.Dispose(); }
public void CannotInterleaveActivityIds() { var activityId = Guid.NewGuid(); var traceSource = new TraceSource(MethodBase.GetCurrentMethod().Name, SourceLevels.All); var context = new ActivityScope(traceSource, activityId); Trace.CorrelationManager.ActivityId = Guid.NewGuid(); var ex = Assert.Throws<InvalidOperationException>(() => context.Dispose()); Assert.Equal(Exceptions.ActivityIdModifiedInsideScope, ex.Message); Trace.CorrelationManager.ActivityId = activityId; context.Dispose(); }