IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
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...
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... | |
![]() | |
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< ITestAction > | UpstreamActions [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... | |
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.
|
inline |
Initializes a new instance of the TestExecutionContext class.
|
inline |
Initializes a new instance of the TestExecutionContext class.
other | An existing instance of TestExecutionContext. |
References NUnit.Framework.Internal.TestExecutionContext._listener, NUnit.Framework.Internal.TestExecutionContext.CurrentPrincipal, NUnit.Framework.Internal.TestExecutionContext.CurrentResult, NUnit.Framework.Internal.TestExecutionContext.CurrentTest, NUnit.Framework.Internal.TestExecutionContext.ParallelScope, NUnit.Framework.Internal.TestExecutionContext.StopOnError, NUnit.Framework.Internal.TestExecutionContext.TestCaseTimeout, NUnit.Framework.Internal.TestExecutionContext.TestObject, NUnit.Framework.Internal.TestExecutionContext.UpstreamActions, and NUnit.Framework.Internal.TestExecutionContext.WorkDirectory.
|
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().
|
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().
|
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.
|
inline |
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.
Referenced by NUnit.Framework.Internal.Execution.WorkItem.RunTest(), NUnit.Framework.Internal.TestExecutionContextTests.SetAndRestoreCurrentCulture(), NUnit.Framework.Internal.TestExecutionContextTests.SetAndRestoreCurrentPrincipal(), and NUnit.Framework.Internal.TestExecutionContextTests.SetAndRestoreCurrentUICulture().
|
inline |
Increments the assert count by one.
Referenced by NUnit.Framework.Assert.IncrementAssertCount().
|
inline |
Increments the assert count by a specified amount.
|
inline |
Obtain lifetime service object
|
private |
Link to a prior saved context
|
private |
Indicates that a stop has been requested
|
private |
The event listener currently receiving notifications
Referenced by NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext().
|
private |
The number of assertions for the current test
|
private |
|
private |
|
private |
The current culture
|
private |
The current UI culture
|
private |
The current test result
|
private |
The current Principal.
|
staticprivate |
The current context, head of the list of saved contexts.
|
staticgetprivate set |
Gets the current context.
The current context.
Referenced by NUnit.Framework.Internal.TestExecutionContextTests.Cleanup(), NUnit.Framework.Assert.IncrementAssertCount(), NUnit.Framework.Internal.TestExecutionContextTests.Initialize(), NUnit.Framework.Internal.TestExecutionContextTests.OneTimeSetUp(), NUnit.Framework.Internal.TestExecutionContextTests.OneTimeTearDown(), NUnit.Framework.Internal.TestExecutionContextTests.TestCanAccessItsOwnFullName(), NUnit.Framework.Internal.TestExecutionContextTests.TestCanAccessItsOwnId(), NUnit.Framework.Internal.TestExecutionContextTests.TestCanAccessItsOwnName(), NUnit.Framework.Internal.TestExecutionContextTests.TestCanAccessItsOwnProperties(), NUnit.Framework.Internal.TestExecutionContextTests.TestContextReflectsCurrentCulture(), NUnit.Framework.Internal.TestExecutionContextTests.TestContextReflectsCurrentPrincipal(), and NUnit.Framework.Internal.TestExecutionContextTests.TestContextReflectsCurrentUICulture().
|
getset |
Gets or sets the current test
Referenced by NUnit.Framework.Internal.TestExecutionContextTests.Cleanup(), NUnit.Framework.Internal.TestExecutionContextTests.FixtureSetUpCanAccessFixtureFullName(), NUnit.Framework.Internal.TestExecutionContextTests.FixtureSetUpCanAccessFixtureId(), NUnit.Framework.Internal.TestExecutionContextTests.FixtureSetUpCanAccessFixtureName(), NUnit.Framework.Internal.TestExecutionContextTests.FixtureSetUpCanAccessFixtureProperties(), NUnit.Framework.Internal.TestExecutionContextTests.OneTimeTearDown(), NUnit.Framework.Internal.Execution.WorkItem.RunTest(), NUnit.Framework.Internal.TestExecutionContextTests.SetUpCanAccessTestFullName(), NUnit.Framework.Internal.TestExecutionContextTests.SetUpCanAccessTestId(), NUnit.Framework.Internal.TestExecutionContextTests.SetUpCanAccessTestName(), NUnit.Framework.Internal.TestExecutionContextTests.SetUpCanAccessTestProperties(), NUnit.Framework.Internal.TestExecutionContextTests.TestCanAccessItsOwnFullName(), NUnit.Framework.Internal.TestExecutionContextTests.TestCanAccessItsOwnId(), NUnit.Framework.Internal.TestExecutionContextTests.TestCanAccessItsOwnName(), NUnit.Framework.Internal.TestExecutionContextTests.TestCanAccessItsOwnProperties(), and NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext().
|
getset |
The time the current test started execution
Referenced by NUnit.Framework.Internal.Execution.WorkItem.RunTest().
|
getset |
The time the current test started in Ticks
Referenced by NUnit.Framework.Internal.Execution.WorkItem.RunTest().
|
getset |
Gets or sets the current test result
Referenced by NUnit.Framework.Internal.Commands.ApplyChangesToContextCommand.Execute(), NUnit.Framework.Internal.Commands.SkipCommand.Execute(), NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(), NUnit.Framework.Internal.Commands.OneTimeTearDownCommand.Execute(), NUnit.Framework.Internal.Commands.SetUpTearDownCommand.Execute(), NUnit.Framework.Internal.Commands.OneTimeSetUpCommand.Execute(), NUnit.Framework.RetryAttribute.RetryCommand.Execute(), NUnit.Framework.RepeatAttribute.RepeatedTestCommand.Execute(), NUnit.Framework.Attributes.Tests.CommandWrapperTests.ExpectedExceptionAttribute.ExpectedExceptionCommand.Execute(), NUnit.Framework.Internal.Commands.SetUpTearDownItem.RunTearDown(), NUnit.Framework.Internal.Execution.WorkItem.RunTest(), NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext(), NUnit.Framework.Internal.Execution.TextCapture.Write(), and NUnit.Framework.Internal.Execution.TextCapture.WriteLine().
|
getprivate set |
Gets a TextWriter that will send output to the current test result.
|
getset |
The current test object - that is the user fixture object on which tests are being executed.
Referenced by NUnit.Framework.Internal.Commands.TestActionCommand.Execute(), NUnit.Framework.Internal.Commands.OneTimeTearDownCommand.Execute(), NUnit.Framework.Internal.Commands.OneTimeSetUpCommand.Execute(), NUnit.Framework.Internal.Commands.SetUpTearDownItem.RunNonAsyncMethod(), NUnit.Framework.Internal.Commands.TestMethodCommand.RunNonAsyncTestMethod(), NUnit.TestUtilities.TestBuilder.RunTest(), NUnit.TestUtilities.TestBuilder.RunTestSuite(), and NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext().
|
getset |
Get or set the working directory
Referenced by NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext().
|
getset |
Get or set indicator that run should stop on the first error
Referenced by NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext().
|
getset |
Gets an enum indicating whether a stop has been requested.
Referenced by NUnit.Framework.Internal.Commands.SetUpTearDownCommand.Execute().
|
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().
|
get |
Gets the RandomGenerator specific to this Test
|
getset |
Gets or sets the test case timeout value
Referenced by NUnit.Framework.TimeoutAttribute.ApplyToContext(), NUnit.Framework.Internal.Execution.WorkItem.Execute(), NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext(), and NUnit.Framework.Attributes.ApplyToContextTests.TimeoutAttribute().
|
getprivate set |
Gets a list of ITestActions set by upstream tests
Referenced by NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext().
|
getset |
Saves or restores the CurrentCulture
Referenced by NUnit.Framework.SetCultureAttribute.ApplyToContext(), NUnit.Framework.Internal.TestExecutionContextTests.FixtureSetUpontextReflectsCurrentCulture(), NUnit.Framework.Internal.TestExecutionContextTests.SetAndRestoreCurrentCulture(), NUnit.Framework.Attributes.ApplyToContextTests.SetCultureAttribute(), NUnit.Framework.Internal.TestExecutionContextTests.SetUpContextReflectsCurrentCulture(), and NUnit.Framework.Internal.TestExecutionContextTests.TestContextReflectsCurrentCulture().
|
getset |
Saves or restores the CurrentUICulture
Referenced by NUnit.Framework.SetUICultureAttribute.ApplyToContext(), NUnit.Framework.Internal.TestExecutionContextTests.FixtureSetUpContextReflectsCurrentUICulture(), NUnit.Framework.Internal.TestExecutionContextTests.SetAndRestoreCurrentUICulture(), NUnit.Framework.Attributes.ApplyToContextTests.SetUICultureAttribute(), NUnit.Framework.Internal.TestExecutionContextTests.SetUpContextReflectsCurrentUICulture(), and NUnit.Framework.Internal.TestExecutionContextTests.TestContextReflectsCurrentUICulture().
|
getset |
Gets or sets the current IPrincipal for the Thread.
Referenced by NUnit.Framework.Internal.TestExecutionContextTests.FixtureSetUpContextReflectsCurrentPrincipal(), NUnit.Framework.Internal.TestExecutionContextTests.SetAndRestoreCurrentPrincipal(), NUnit.Framework.Internal.TestExecutionContextTests.SetUpContextReflectsCurrentPrincipal(), NUnit.Framework.Internal.TestExecutionContextTests.TestContextReflectsCurrentPrincipal(), and NUnit.Framework.Internal.TestExecutionContext.TestExecutionContext().