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.TestExecutionContext Class Reference

Helper class used to save and restore certain static or singleton settings in the environment that affect tests or which might be changed by the user tests. More...

+ Inheritance diagram for NUnit.Framework.Internal.TestExecutionContext:
+ Collaboration diagram for NUnit.Framework.Internal.TestExecutionContext:

Public Member Functions

 TestExecutionContext ()
 Initializes a new instance of the TestExecutionContext class. More...
 
 TestExecutionContext (TestExecutionContext other)
 Initializes a new instance of the TestExecutionContext class. More...
 
void UpdateContextFromEnvironment ()
 Record any changes in the environment made by the test code in the execution context so it will be passed on to lower level tests. More...
 
void EstablishExecutionEnvironment ()
 Set up the execution environment to match a context. Note that we may be running on the same thread where the context was initially created or on a different thread. More...
 
void IncrementAssertCount ()
 Increments the assert count by one. More...
 
void IncrementAssertCount (int count)
 Increments the assert count by a specified amount. More...
 
override object InitializeLifetimeService ()
 Obtain lifetime service object More...
 
- Public Member Functions inherited from NUnit.Framework.Compatibility.LongLivedMarshalByRefObject
override object InitializeLifetimeService ()
 Obtains a lifetime service object to control the lifetime policy for this instance. More...
 

Static Public Member Functions

static TestExecutionContext GetTestExecutionContext ()
 Get the current context or return null if none is found. More...
 
static void ClearCurrentContext ()
 Clear the current context. This is provided to prevent "leakage" of the CallContext containing the current context back to any runners. More...
 

Properties

static TestExecutionContext CurrentContext [get, private set]
 Gets the current context. More...
 
Test CurrentTest [get, set]
 Gets or sets the current test More...
 
DateTime StartTime [get, set]
 The time the current test started execution More...
 
long StartTicks [get, set]
 The time the current test started in Ticks More...
 
TestResult CurrentResult [get, set]
 Gets or sets the current test result More...
 
TextWriter OutWriter [get, private set]
 Gets a TextWriter that will send output to the current test result. More...
 
object TestObject [get, set]
 The current test object - that is the user fixture object on which tests are being executed. More...
 
string WorkDirectory [get, set]
 Get or set the working directory More...
 
bool StopOnError [get, set]
 Get or set indicator that run should stop on the first error More...
 
TestExecutionStatus ExecutionStatus [get, set]
 Gets an enum indicating whether a stop has been requested. More...
 
ParallelScope ParallelScope [get, set]
 The ParallelScope to be used by tests running in this context. For builds with out the parallel feature, it has no effect. More...
 
Randomizer RandomGenerator [get]
 Gets the RandomGenerator specific to this Test More...
 
int TestCaseTimeout [get, set]
 Gets or sets the test case timeout value More...
 
List< ITestActionUpstreamActions [get, private set]
 Gets a list of ITestActions set by upstream tests More...
 
CultureInfo CurrentCulture [get, set]
 Saves or restores the CurrentCulture More...
 
CultureInfo CurrentUICulture [get, set]
 Saves or restores the CurrentUICulture More...
 
IPrincipal CurrentPrincipal [get, set]
 Gets or sets the current IPrincipal for the Thread. More...
 

Private Attributes

TestExecutionContext _priorContext
 Link to a prior saved context More...
 
TestExecutionStatus _executionStatus
 Indicates that a stop has been requested More...
 
ITestListener _listener = TestListener.NULL
 The event listener currently receiving notifications More...
 
int _assertCount
 The number of assertions for the current test More...
 
Randomizer _randomGenerator
 
IWorkItemDispatcher _dispatcher
 
CultureInfo _currentCulture
 The current culture More...
 
CultureInfo _currentUICulture
 The current UI culture More...
 
TestResult _currentResult
 The current test result More...
 
IPrincipal _currentPrincipal
 The current Principal. More...
 

Static Private Attributes

static readonly string CONTEXT_KEY = "NUnit.Framework.TestContext"
 The current context, head of the list of saved contexts. More...
 

Detailed Description

Helper class used to save and restore certain static or singleton settings in the environment that affect tests or which might be changed by the user tests.

An internal class is used to hold settings and a stack of these objects is pushed and popped as Save and Restore are called.

Constructor & Destructor Documentation

NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext ( )
inline

Initializes a new instance of the TestExecutionContext class.

Member Function Documentation

static TestExecutionContext NUnit.Framework.Internal.TestExecutionContext.GetTestExecutionContext ( )
inlinestatic

Get the current context or return null if none is found.

Referenced by NUnit.Framework.Internal.Execution.TextCapture.Write(), and NUnit.Framework.Internal.Execution.TextCapture.WriteLine().

static void NUnit.Framework.Internal.TestExecutionContext.ClearCurrentContext ( )
inlinestatic

Clear the current context. This is provided to prevent "leakage" of the CallContext containing the current context back to any runners.

Referenced by NUnit.Framework.Api.FrameworkController.RunTests().

void NUnit.Framework.Internal.TestExecutionContext.UpdateContextFromEnvironment ( )
inline

Record any changes in the environment made by the test code in the execution context so it will be passed on to lower level tests.

void NUnit.Framework.Internal.TestExecutionContext.EstablishExecutionEnvironment ( )
inline
void NUnit.Framework.Internal.TestExecutionContext.IncrementAssertCount ( )
inline

Increments the assert count by one.

Referenced by NUnit.Framework.Assert.IncrementAssertCount().

void NUnit.Framework.Internal.TestExecutionContext.IncrementAssertCount ( int  count)
inline

Increments the assert count by a specified amount.

override object NUnit.Framework.Internal.TestExecutionContext.InitializeLifetimeService ( )
inline

Obtain lifetime service object

Returns

Member Data Documentation

TestExecutionContext NUnit.Framework.Internal.TestExecutionContext._priorContext
private

Link to a prior saved context

TestExecutionStatus NUnit.Framework.Internal.TestExecutionContext._executionStatus
private

Indicates that a stop has been requested

ITestListener NUnit.Framework.Internal.TestExecutionContext._listener = TestListener.NULL
private

The event listener currently receiving notifications

Referenced by NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext().

int NUnit.Framework.Internal.TestExecutionContext._assertCount
private

The number of assertions for the current test

Randomizer NUnit.Framework.Internal.TestExecutionContext._randomGenerator
private
IWorkItemDispatcher NUnit.Framework.Internal.TestExecutionContext._dispatcher
private
CultureInfo NUnit.Framework.Internal.TestExecutionContext._currentCulture
private

The current culture

CultureInfo NUnit.Framework.Internal.TestExecutionContext._currentUICulture
private

The current UI culture

TestResult NUnit.Framework.Internal.TestExecutionContext._currentResult
private

The current test result

IPrincipal NUnit.Framework.Internal.TestExecutionContext._currentPrincipal
private

The current Principal.

readonly string NUnit.Framework.Internal.TestExecutionContext.CONTEXT_KEY = "NUnit.Framework.TestContext"
staticprivate

The current context, head of the list of saved contexts.

Property Documentation

DateTime NUnit.Framework.Internal.TestExecutionContext.StartTime
getset

The time the current test started execution

Referenced by NUnit.Framework.Internal.Execution.WorkItem.RunTest().

long NUnit.Framework.Internal.TestExecutionContext.StartTicks
getset

The time the current test started in Ticks

Referenced by NUnit.Framework.Internal.Execution.WorkItem.RunTest().

TextWriter NUnit.Framework.Internal.TestExecutionContext.OutWriter
getprivate set

Gets a TextWriter that will send output to the current test result.

string NUnit.Framework.Internal.TestExecutionContext.WorkDirectory
getset

Get or set the working directory

Referenced by NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext().

bool NUnit.Framework.Internal.TestExecutionContext.StopOnError
getset

Get or set indicator that run should stop on the first error

Referenced by NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext().

TestExecutionStatus NUnit.Framework.Internal.TestExecutionContext.ExecutionStatus
getset

Gets an enum indicating whether a stop has been requested.

Referenced by NUnit.Framework.Internal.Commands.SetUpTearDownCommand.Execute().

ParallelScope NUnit.Framework.Internal.TestExecutionContext.ParallelScope
getset

The ParallelScope to be used by tests running in this context. For builds with out the parallel feature, it has no effect.

Referenced by NUnit.Framework.ParallelizableAttribute.ApplyToContext(), NUnit.Framework.Attributes.ApplyToContextTests.ParallelizableAttribute(), and NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext().

Randomizer NUnit.Framework.Internal.TestExecutionContext.RandomGenerator
get

Gets the RandomGenerator specific to this Test

List<ITestAction> NUnit.Framework.Internal.TestExecutionContext.UpstreamActions
getprivate set

Gets a list of ITestActions set by upstream tests

Referenced by NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext().


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