TestAutomationEssentials.MSTest.ExecutionContext.TestExecutionScopesManager.EndIsolationScope C# (CSharp) Method

EndIsolationScope() public method

Ends the current isolation scope, calling all cleanup actions that were added to this scope in reverse order
public EndIsolationScope ( ) : void
return void
        public void EndIsolationScope()
        {
            CleanupCurrentLevel();
            _currentIsolationLevel = _isolationLevels.Pop();
        }

Usage Example

 public void CanAddCleanupActionAfterOneLevelWasPoppoed()
 {
     var context = new TestExecutionScopesManager("dummy", Functions.EmptyAction<IIsolationScope>());
     context.BeginIsolationScope("Level1", Functions.EmptyAction<IIsolationScope>());
     context.EndIsolationScope();
     var cleanupCalled = false;
     context.AddCleanupAction(() => cleanupCalled = true);
     context.EndIsolationScope();
     Assert.IsTrue(cleanupCalled, "Cleanup action hasn't been called");
 }
All Usage Examples Of TestAutomationEssentials.MSTest.ExecutionContext.TestExecutionScopesManager::EndIsolationScope