Esempio n. 1
0
            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();
            }
Esempio n. 2
0
            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();
            }
            public void CanDisposeRepeatedly()
            {
                var traceSource = new TraceSource(MethodBase.GetCurrentMethod().Name, SourceLevels.All);

                using (var context = new ActivityScope(traceSource, Guid.Empty))
                    context.Dispose();
            }