C# Class NUnit.Framework.Internal.Execution.WorkItem

A WorkItem may be an individual test case, a fixture or a higher level grouping of tests. All WorkItems inherit from the abstract WorkItem class, which uses the template pattern to allow derived classes to perform work in whatever way is needed. A WorkItem is created with a particular TestExecutionContext and is responsible for re-establishing that context in the current thread before it begins or resumes execution.
Afficher le fichier Open project: nunit/nunit

Private Properties

Свойство Type Description
RunTest void
RunTestOnOwnThread void
RunThread void

Méthodes publiques

Méthode Description
Cancel ( bool force ) : void

Cancel (abort or stop) a WorkItem

CreateWorkItem ( ITest test, ITestFilter filter ) : WorkItem

Creates a work item.

Execute ( ) : void

Execute the current work item, including any child work items.

InitializeContext ( TestExecutionContext context ) : void

Initialize the TestExecutionContext. This must be done before executing the WorkItem.

Originally, the context was provided in the constructor but delaying initialization of the context until the item is about to be dispatched allows changes in the parent context during OneTimeSetUp to be reflected in the child.

WorkItem ( System.Test test ) : System

Construct a WorkItem for a particular test.

Méthodes protégées

Méthode Description
PerformWork ( ) : void

Method that performs actually performs the work. It should set the State to WorkItemState.Complete when done.

WorkItemComplete ( ) : void

Method called by the derived class when all work is complete

Private Methods

Méthode Description
RunTest ( ) : void
RunTestOnOwnThread ( int timeout, ApartmentState apartment ) : void
RunThread ( int timeout ) : void

Method Details

Cancel() public méthode

Cancel (abort or stop) a WorkItem
public Cancel ( bool force ) : void
force bool true if the WorkItem should be aborted, false if it should run to completion
Résultat void

CreateWorkItem() static public méthode

Creates a work item.
static public CreateWorkItem ( ITest test, ITestFilter filter ) : WorkItem
test ITest The test for which this WorkItem is being created.
filter ITestFilter The filter to be used in selecting any child Tests.
Résultat WorkItem

Execute() public méthode

Execute the current work item, including any child work items.
public Execute ( ) : void
Résultat void

InitializeContext() public méthode

Initialize the TestExecutionContext. This must be done before executing the WorkItem.
Originally, the context was provided in the constructor but delaying initialization of the context until the item is about to be dispatched allows changes in the parent context during OneTimeSetUp to be reflected in the child.
public InitializeContext ( TestExecutionContext context ) : void
context TestExecutionContext The TestExecutionContext to use
Résultat void

PerformWork() protected abstract méthode

Method that performs actually performs the work. It should set the State to WorkItemState.Complete when done.
protected abstract PerformWork ( ) : void
Résultat void

WorkItem() public méthode

Construct a WorkItem for a particular test.
public WorkItem ( System.Test test ) : System
test System.Test The test that the WorkItem will run
Résultat System

WorkItemComplete() protected méthode

Method called by the derived class when all work is complete
protected WorkItemComplete ( ) : void
Résultat void