コード例 #1
0
		public void TestCleanup()
		{
			ICallContext context = CallContextManagerInstance.CallContextOverride;

			ICallContext existingContext = context.ExistingCallContext();
			Correlation.CorrelationEnd();
			context.EndCallContext();
		}
コード例 #2
0
        /// <summary>
        /// End a request
        /// </summary>
        private void EndRequest()
        {
            ICallContext context = CallContextManagerInstance.CallContextOverride;

            ICallContext existingContext = context.ExistingCallContext();

            Correlation.CorrelationEnd();
            context.EndCallContext();
        }
コード例 #3
0
        public void SettingShouldLogDirectly_OnCurrentCorrelation_ShouldSetOnCorrelationOnly()
        {
            try
            {
                Correlation = new Correlation(new MemoryCorrelationHandler(), CallContextManagerInstance, MachineInformation);

                Assert.False(Correlation.ShouldLogDirectly, "ShouldLogDirectly should be set to false by default.");

                Correlation.CorrelationStart(null);
                Correlation.ShouldLogDirectly = true;

                Assert.True(Correlation.ShouldLogDirectly, "ShouldLogDirectly should be set to true.");

                Correlation.CorrelationEnd();

                Assert.False(Correlation.ShouldLogDirectly, "ShouldLogDirectly should be set to false after correlation ended.");
            }
            finally
            {
                EndRequest();
            }
        }
コード例 #4
0
        public void CorrelationEnd_MultipleCorrelations_ShouldUnwindHierarchy()
        {
            Correlation = new Correlation(new MemoryCorrelationHandler(), CallContextManagerInstance, MachineInformation);

            Guid[] correlations = new Guid[3];
            for (int i = 0; i < 3; i++)
            {
                Correlation.CorrelationStart(null);
                correlations[i] = Correlation.CurrentCorrelation.VisibleId;
            }

            for (int i = 2; i >= 0; i--)
            {
                CorrelationData currentCorrelation = Correlation.CurrentCorrelation;
                Assert.Equal(correlations[i], currentCorrelation.VisibleId);

                Correlation.CorrelationEnd();
            }

            Assert.Null(Correlation.CurrentCorrelation);

            CallContextManagerInstance.CallContextOverride.EndCallContext();
        }