<PackageReference Include="NUnit" Version="4.3.1" />

NUnit.Framework.Internal.Execution.WorkItem

public abstract class WorkItem : IDisposable
public TestExecutionContext Context { get; }

public ITestFilter Filter { get; }

public virtual bool IsolateChildTests { get; }

public virtual string Name { get; }

public ParallelScope ParallelScope { get; }

public TestResult Result { get; protected set; }

public WorkItemState State { get; protected set; }

public Test Test { get; }

public TestWorker TestWorker { get; }

public event EventHandler Completed

public WorkItem(Test test, ITestFilter filter)

Construct a WorkItem for a particular test.

public WorkItem(WorkItem wrappedItem)

Construct a work Item that wraps another work Item. Wrapper items are used to represent independently dispatched tasks, which form part of the execution of a single test, such as OneTimeTearDown.

protected List<SetUpTearDownItem> BuildSetUpTearDownList(IMethodInfo[] setUpMethods, IMethodInfo[] tearDownMethods, IMethodValidator methodValidator = null)

Builds the set up tear down list.

public virtual void Cancel(bool force)

Cancel (abort or stop) a WorkItem

protected void ChangeResult(ResultState resultState, string message)

Changes the result of the test, logging the old and new states

public void Dispose()

Standard Dispose

public virtual void Execute()

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

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

public void MarkNotRunnable(string reason)

Marks the WorkItem as NotRunnable.

protected abstract void PerformWork()

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

public void WaitForCompletion()

Wait until the execution of this item is complete

protected void WorkItemComplete()

Method called by the derived class when all work is complete