Sets the default context for the specified thread.

Namespace:  Gallio.Framework
Assembly:  Gallio (in Gallio.dll) Version: 3.3.0.0 (3.3.610.0)

Syntax

C#
public static void SetThreadDefaultContext(
	Thread thread,
	TestContext context
)
Visual Basic (Declaration)
Public Shared Sub SetThreadDefaultContext ( _
	thread As Thread, _
	context As TestContext _
)

Parameters

thread
Type: System.Threading..::.Thread
The thread.
context
Type: Gallio.Framework..::.TestContext
The context to associate with the thread, or null to reset the thread's default context to inherit the GlobalContext once again.

Remarks

The default context for a thread is GlobalContext unless the thread's default context has been overridden with SetThreadDefaultContext(Thread, TestContext).

Changing the default context of a thread is useful for capturing existing threads created outside of a test into a particular context. Among other things, this ensures that side-effects of the thread, such as writing text to the console, are recorded as part of the step represented by the specified context.

Exceptions

ExceptionCondition
System..::.ArgumentNullExceptionThrown if thread is null.

See Also