public void CorrelationClear_ShouldClearAllCorrelations() { try { Correlation = new Correlation(new MemoryCorrelationHandler(), CallContextManagerInstance, MachineInformation); Correlation.CorrelationStart(null); CorrelationData previousCorrelation = Correlation.CurrentCorrelation; for (int i = 0; i < (new Random()).Next(3, 10); i++) { Correlation.CorrelationStart(null); CorrelationData parentCorrelation = Correlation.CurrentCorrelation.ParentCorrelation; Assert.Same(previousCorrelation, parentCorrelation); previousCorrelation = Correlation.CurrentCorrelation; } Assert.NotNull(Correlation.CurrentCorrelation); Correlation.CorrelationClear(); Assert.Null(Correlation.CurrentCorrelation); } finally { EndRequest(); } }
public void SettingShouldLogDirectly_OnBaseCorrelation_ShouldBeInheritedByCurrentCorrelation() { 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; Correlation.CorrelationStart(null); Assert.True(Correlation.ShouldLogDirectly, "ShouldLogDirectly should be set to true."); Correlation.CorrelationClear(); } finally { EndRequest(); } }