<PackageReference Include="NUnit" Version="3.0.0-alpha-2" />

TestExecutionContext

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.
public static TestExecutionContext CurrentContext { get; }

Gets the current context.

public CultureInfo CurrentCulture { get; set; }

Saves or restores the CurrentCulture

public IPrincipal CurrentPrincipal { get; set; }

Gets or sets the current IPrincipal for the Thread.

public TestResult CurrentResult { get; set; }

Gets or sets the current test result

public Test CurrentTest { get; set; }

Gets or sets the current test

public CultureInfo CurrentUICulture { get; set; }

Saves or restores the CurrentUICulture

public TestExecutionStatus ExecutionStatus { get; set; }

Gets an enum indicating whether a stop has been requested.

public ParallelScope ParallelScope { get; set; }

The ParallelScope to be used by tests running in this context

Gets the RandomGenerator specific to this Test

public long StartTicks { get; set; }

The time the current test started in Ticks

public DateTime StartTime { get; set; }

The time the current test started execution

public bool StopOnError { get; set; }

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

public int TestCaseTimeout { get; set; }

Gets or sets the test case timeout value

public object TestObject { get; set; }

The current test object - that is the user fixture object on which tests are being executed.

public List<ITestAction> UpstreamActions { get; }

Gets a list of ITestActions set by upstream tests

public string WorkDirectory { get; set; }

Get or set the working directory

Initializes a new instance of the TestExecutionContext class.

Initializes a new instance of the TestExecutionContext class.

public static void ClearCurrentContext()

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

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

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.

public void IncrementAssertCount()

Increments the assert count by one.

public void IncrementAssertCount(int count)

Increments the assert count by a specified amount.

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.