Table of Contents

Class TestActionItem

Namespace
NUnit.Framework.Internal.Commands
Assembly
nunit.framework.dll

TestActionItem wraps a single execution of an ITestAction. Its primary purpose is to track whether the BeforeTest method has been called and suppress calling the AfterTest method if it has not. This is necessary when ITestActions are used before and after a CompositeWorkItem, since the OneTimeSetUpCommand and OneTimeTearDownCommand are separate command chains. By sharing a TestActionItem between the setup and teardown chains, the two calls can be coordinated.

public class TestActionItem
Inheritance
TestActionItem
Inherited Members

Constructors

TestActionItem(ITestAction)

Construct a TestActionItem

public TestActionItem(ITestAction action)

Parameters

action ITestAction

The ITestAction to be included

Properties

BeforeTestWasRun

Get flag indicating if the BeforeTest entry was already called.

public bool BeforeTestWasRun { get; }

Property Value

bool

Methods

AfterTest(ITest)

Run the AfterTest action, but only if the BeforeTest action was actually run.

public void AfterTest(ITest test)

Parameters

test ITest

The test to which the action applies

BeforeTest(ITest)

Run the BeforeTest method of the action and remember that it has been run.

public void BeforeTest(ITest test)

Parameters

test ITest

The test to which the action applies