Class TestScenarioScopeBuilder
- Namespace
- XBullet.EasyTesting.Hosting
- Assembly
- XBullet.EasyTesting.dll
Configures service and application-configuration overrides for one test scope.
public sealed class TestScenarioScopeBuilder
- Inheritance
-
TestScenarioScopeBuilder
- Inherited Members
- Extension Methods
Methods
ConfigureConfiguration(Action<IConfigurationBuilder>)
Adds a configuration override that exists only for this scenario.
public TestScenarioScopeBuilder ConfigureConfiguration(Action<IConfigurationBuilder> configure)
Parameters
configureAction<IConfigurationBuilder>The callback invoked during scenario host construction after environment resources have contributed their configuration. It receives the caller-owned configuration builder, runs once for this scenario, and is not invoked concurrently by a single test factory.
Returns
- TestScenarioScopeBuilder
This builder so additional scenario overrides can be registered.
ConfigureServices(Action<IServiceCollection>)
Adds a service override that exists only for this scenario.
public TestScenarioScopeBuilder ConfigureServices(Action<IServiceCollection> configure)
Parameters
configureAction<IServiceCollection>The callback invoked during scenario host construction after environment resources and the factory have registered their services. It receives the caller-owned service collection, runs once for this scenario, and is not invoked concurrently by a single test factory.
Returns
- TestScenarioScopeBuilder
This builder so additional scenario overrides can be registered.
UseEnvironmentResource(string, Func<TestScenarioContext, ITestScenarioEnvironmentResource>)
Adds an external dependency factory owned by this scenario.
public TestScenarioScopeBuilder UseEnvironmentResource(string name, Func<TestScenarioContext, ITestScenarioEnvironmentResource> createResource)
Parameters
namestringThe non-empty, case-insensitively unique name used to retrieve the resource from the scope.
createResourceFunc<TestScenarioContext, ITestScenarioEnvironmentResource>The factory invoked once while this scenario is being created. It receives the scenario context and must return a non-null resource. The scenario assumes ownership of the returned resource and disposes it during cleanup.
Returns
- TestScenarioScopeBuilder
This builder so additional scenario overrides can be registered.
UseEnvironmentResource(string, ITestScenarioEnvironmentResource)
Adds an external dependency owned by this scenario.
public TestScenarioScopeBuilder UseEnvironmentResource(string name, ITestScenarioEnvironmentResource resource)
Parameters
namestringThe non-empty, case-insensitively unique name used to retrieve the resource from the scope.
resourceITestScenarioEnvironmentResourceThe resource whose ownership transfers to this scenario. It is started before the test host and asynchronously disposed during scenario cleanup.
Returns
- TestScenarioScopeBuilder
This builder so additional scenario overrides can be registered.