IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
NUnit.Framework.Internal.Execution.WorkItem Class Referenceabstract

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. More...

+ Inheritance diagram for NUnit.Framework.Internal.Execution.WorkItem:
+ Collaboration diagram for NUnit.Framework.Internal.Execution.WorkItem:

Public Member Functions

 WorkItem (Test test)
 Construct a WorkItem for a particular test. More...
 
void InitializeContext (TestExecutionContext context)
 Initialize the TestExecutionContext. This must be done before executing the WorkItem. More...
 
virtual void Execute ()
 Execute the current work item, including any child work items. More...
 

Static Public Member Functions

static WorkItem CreateWorkItem (ITest test, ITestFilter filter)
 Creates a work item. More...
 

Protected Member Functions

abstract void PerformWork ()
 Method that performs actually performs the work. It should set the State to WorkItemState.Complete when done. More...
 
void WorkItemComplete ()
 Method called by the derived class when all work is complete More...
 

Properties

WorkItemState State [get]
 Gets the current state of the WorkItem More...
 
Test Test [get]
 The test being executed by the work item More...
 
TestExecutionContext Context [get]
 The execution context More...
 
List< ITestActionActions [get]
 The test actions to be performed before and after this test More...
 
TestResult Result [get, protected set]
 The test result More...
 

Events

EventHandler Completed
 Event triggered when the item is complete More...
 

Private Member Functions

void RunTestOnOwnThread (int timeout, ApartmentState apartment)
 
void RunTest ()
 

Private Attributes

WorkItemState _state
 
Test _test
 
TestExecutionContext _context
 
List< ITestAction_actions = new List<ITestAction>()
 

Static Private Attributes

static Logger log = InternalTrace.GetLogger("WorkItem")
 

Detailed Description

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.

Constructor & Destructor Documentation

NUnit.Framework.Internal.Execution.WorkItem.WorkItem ( Test  test)
inline

Construct a WorkItem for a particular test.

Parameters
testThe test that the WorkItem will run

References NUnit.Framework.Internal.Test.MakeTestResult().

Member Function Documentation

static WorkItem NUnit.Framework.Internal.Execution.WorkItem.CreateWorkItem ( ITest  test,
ITestFilter  filter 
)
inlinestatic

Creates a work item.

Parameters
testThe test for which this WorkItem is being created.
filterThe filter to be used in selecting any child Tests.
Returns

Referenced by NUnit.Framework.Internal.Execution.CompositeWorkItem.CreateChildWorkItems(), NUnit.Framework.Api.NUnitTestAssemblyRunner.RunAsync(), NUnit.TestUtilities.TestBuilder.RunTest(), and NUnit.TestUtilities.TestBuilder.RunTestSuite().

void NUnit.Framework.Internal.Execution.WorkItem.InitializeContext ( TestExecutionContext  context)
inline

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.

Parameters
contextThe TestExecutionContext to use

References NUnit.Framework.Internal.Test.Method, NUnit.Framework.Interfaces.IMethodInfo.MethodInfo, NUnit.Framework.Interfaces.ITypeInfo.Type, and NUnit.Framework.Internal.Test.TypeInfo.

Referenced by NUnit.Framework.Api.NUnitTestAssemblyRunner.RunAsync(), NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren(), NUnit.TestUtilities.TestBuilder.RunTest(), and NUnit.TestUtilities.TestBuilder.RunTestSuite().

void NUnit.Framework.Internal.Execution.WorkItem.RunTestOnOwnThread ( int  timeout,
ApartmentState  apartment 
)
inlineprivate
abstract void NUnit.Framework.Internal.Execution.WorkItem.PerformWork ( )
protectedpure virtual

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

Implemented in NUnit.TestUtilities.FakeWorkItem, NUnit.TestUtilities.FakeWorkItem, NUnit.Framework.Internal.Execution.CompositeWorkItem, and NUnit.Framework.Internal.Execution.SimpleWorkItem.

void NUnit.Framework.Internal.Execution.WorkItem.WorkItemComplete ( )
inlineprotected

Method called by the derived class when all work is complete

References NUnit.Framework.Interfaces.ITestListener.TestFinished().

Member Data Documentation

Logger NUnit.Framework.Internal.Execution.WorkItem.log = InternalTrace.GetLogger("WorkItem")
staticprivate
WorkItemState NUnit.Framework.Internal.Execution.WorkItem._state
private
Test NUnit.Framework.Internal.Execution.WorkItem._test
private
TestExecutionContext NUnit.Framework.Internal.Execution.WorkItem._context
private
List<ITestAction> NUnit.Framework.Internal.Execution.WorkItem._actions = new List<ITestAction>()
private

Property Documentation

WorkItemState NUnit.Framework.Internal.Execution.WorkItem.State
get
Test NUnit.Framework.Internal.Execution.WorkItem.Test
get

The test being executed by the work item

TestExecutionContext NUnit.Framework.Internal.Execution.WorkItem.Context
get

The execution context

List<ITestAction> NUnit.Framework.Internal.Execution.WorkItem.Actions
get

The test actions to be performed before and after this test

Event Documentation

EventHandler NUnit.Framework.Internal.Execution.WorkItem.Completed

The documentation for this class was generated from the following file: