A context in which a Metalama unit test can run, configured with most required Metalama services and optionally some mocks.
Implements
Namespace: Metalama.Testing.UnitTesting
Assembly: Metalama.Testing.UnitTesting.dll
Syntax
public class TestContext : ITempFileManager, IApplicationInfoProvider, IDateTimeProvider, IBackstageService, IDisposable
Constructors
Name | Description |
---|---|
TestContext(TestContextOptions, IAdditionalServiceCollection?, CancellationToken) | Initializes a new instance of the TestContext class and specify an optional IAdditionalServiceCollection. Tests typically do not call this constructor directly, but instead the CreateTestContext(IAdditionalServiceCollection, string?, string?) method. |
TestContext(TestContextOptions, CancellationToken) | Initializes a new instance of the TestContext class. Tests typically do not call this constructor directly, but instead the CreateTestContext(IAdditionalServiceCollection, string?, string?) method. |
Properties
Name | Description |
---|---|
BaseDirectory | Gets the directory that was specifically created for the current test and where all specific files should be stored. |
CancellationToken | Gets a CancellationToken used to cancel the test in case of timeout. The timeout period is defined by the Timeout option. |
Logger | |
PlugIns | |
ProjectOptions | |
ServiceProvider | Gets the ProjectServiceProvider for the current context. |
TestName | Gets the test name, for diagnostics. |