C# Class TestAutomationEssentials.MSTest.ExecutionContext.TestExecutionScopesManager

Managed nestable scopes of isolation. Upon exit from each scope, it calls the cleanup actions that were registered to it during its lifetime
If you're using MSTest, you should probably use TestBase instead of using this class directly.
Inheritance: IIsolationScope
Show file Open project: arnonax/TestEssentials Class Usage Examples

Public Methods

Method Description
AddCleanupAction ( System.Action action ) : void

Adds a delegate to an action that will be executed on cleanup

BeginIsolationScope ( string isolationScopeName ) : IDisposable

Begins a new, nested, isolation scope

BeginIsolationScope ( string isolationScopeName, Action initialize ) : IDisposable

Begins a new, nested, isolation scope

EndIsolationScope ( ) : void

Ends the current isolation scope, calling all cleanup actions that were added to this scope in reverse order

TestExecutionScopesManager ( string name, Action initialize ) : System

Initializes a new TestExecutionScopesManager object, with one (default) isolation scope

Private Methods

Method Description
CleanupCurrentLevel ( ) : void

Method Details

AddCleanupAction() public method

Adds a delegate to an action that will be executed on cleanup
public AddCleanupAction ( System.Action action ) : void
action System.Action A delegate to the action to perform
return void

BeginIsolationScope() public method

Begins a new, nested, isolation scope
public BeginIsolationScope ( string isolationScopeName ) : IDisposable
isolationScopeName string The name of the new isolation scope
return IDisposable

BeginIsolationScope() public method

Begins a new, nested, isolation scope
public BeginIsolationScope ( string isolationScopeName, Action initialize ) : IDisposable
isolationScopeName string The name of the new isolation scope
initialize Action A delegate to an action that is performed on initialization. If an exception occurs inside this /// method, then the scope is automatically destroyed, calling any cleanup actions that were added during this method
return IDisposable

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

TestExecutionScopesManager() public method

Initializes a new TestExecutionScopesManager object, with one (default) isolation scope
public TestExecutionScopesManager ( string name, Action initialize ) : System
name string The name of the isolation scope
initialize Action A delegate to an action that is performed on initialization. If an exception occurs inside this /// method, then the scope is automatically destroyed, calling any cleanup actions that were added during this method
return System