public void Test_IsEnabled_MockType_DebugMode_InfoLevel_SettingsTrue_ReturnsTrue() { LogSupervisor supervisor = new LogSupervisor(); supervisor.ModeDetector = new MockModeDetector(true); supervisor.SettingsManager = MockLogSettingsManager.NewSpecified(true); bool isEnabled = supervisor.IsEnabled("MockType", LogLevel.Info); Assert.IsTrue(isEnabled, "Should have been true."); }
internal void End() { // Ensure this doesnt run twice for the same group. if (!HasEnded) { LogSupervisor supervisor = new LogSupervisor(); if (CallingMethod != null && supervisor.IsEnabled(CallingMethod.DeclaringType.Name, LogLevel)) { // Keep popping groups from the stack until it reaches the correct level // This loop ensures that if a parent group ends before a child group that the child group(s) will be popped // as well and the stack won't become corrupted // TODO: Check if this loop should be moved to DiagnosticState.PopGroup while (supervisor.CanPop(this, DiagnosticState.CurrentGroup)) { DiagnosticState.PopGroup(); } } HasEnded = true; } }
internal void End() { // Ensure this doesnt run twice for the same group. if (!HasEnded) { LogSupervisor supervisor = new LogSupervisor(); if (CallingMethod != null && supervisor.IsEnabled(CallingMethod.DeclaringType.Name, LogLevel)) { // Keep popping groups from the stack until it reaches the correct level // This loop ensures that if a parent group ends before a child group that the child group(s) will be popped // as well and the stack won't become corrupted // TODO: Check if this loop should be moved to DiagnosticState.PopGroup while (supervisor.CanPop(this, DiagnosticState.CurrentGroup)) DiagnosticState.PopGroup(); } HasEnded = true; } }