public void Test_CanPop_False() { LogGroup logGroup1 = LogGroup.Start("Test"); LogGroup logGroup2 = LogGroup.Start("Test2"); logGroup2.Parent = logGroup1; LogSupervisor supervisor = new LogSupervisor(); bool canPop = supervisor.CanPop(logGroup2, logGroup1); Assert.IsFalse(canPop); }
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; } }