Class TestcontainerModuleExtensions

Namespace
XBullet.EasyTesting.Testcontainers
Assembly
XBullet.EasyTesting.Testcontainers.dll

Registers supported preconfigured Testcontainers modules.

public static class TestcontainerModuleExtensions
Inheritance
TestcontainerModuleExtensions
Inherited Members

Remarks

Methods

UseAzurite(TestScenarioScopeBuilder)

Adds an Azurite container to one scenario.

public static TestScenarioScopeBuilder UseAzurite(this TestScenarioScopeBuilder builder)

Parameters

builder TestScenarioScopeBuilder

The non-null scenario-scope builder to configure.

Returns

TestScenarioScopeBuilder

The same builder, configured with resource name Azurite and configuration key ConnectionStrings:AzureStorage.

UseAzurite(TestScenarioScopeBuilder, Action<TestcontainerModuleOptions<AzuriteBuilder>>)

Adds a configured Azurite container to one scenario.

public static TestScenarioScopeBuilder UseAzurite(this TestScenarioScopeBuilder builder, Action<TestcontainerModuleOptions<AzuriteBuilder>> configure)

Parameters

builder TestScenarioScopeBuilder

The non-null scenario-scope builder to configure.

configure Action<TestcontainerModuleOptions<AzuriteBuilder>>

A non-null callback invoked synchronously once to change names or add native Azurite builder transformations. Transformations run once when the scenario creates its container.

Returns

TestScenarioScopeBuilder

The same builder, configured for a lazy, scenario-owned Azurite container whose connection string is published after readiness.

UseAzurite<TEntryPoint>(EasyTestHostBuilder<TEntryPoint>)

Adds an Azurite container to every scenario.

public static EasyTestHostBuilder<TEntryPoint> UseAzurite<TEntryPoint>(this EasyTestHostBuilder<TEntryPoint> builder) where TEntryPoint : class

Parameters

builder EasyTestHostBuilder<TEntryPoint>

The non-null host builder to configure.

Returns

EasyTestHostBuilder<TEntryPoint>

The same builder, configured to create an Azurite container named Azurite per scenario and publish its connection string as ConnectionStrings:AzureStorage.

Type Parameters

TEntryPoint

The application entry-point type configured by the host builder.

UseAzurite<TEntryPoint>(EasyTestHostBuilder<TEntryPoint>, Action<TestcontainerModuleOptions<AzuriteBuilder>>)

Adds a configured Azurite container to every scenario.

public static EasyTestHostBuilder<TEntryPoint> UseAzurite<TEntryPoint>(this EasyTestHostBuilder<TEntryPoint> builder, Action<TestcontainerModuleOptions<AzuriteBuilder>> configure) where TEntryPoint : class

Parameters

builder EasyTestHostBuilder<TEntryPoint>

The non-null host builder to configure.

configure Action<TestcontainerModuleOptions<AzuriteBuilder>>

A non-null callback invoked synchronously once to change the resource name, configuration key, or add native Azurite builder transformations. Transformations run once per scenario.

Returns

EasyTestHostBuilder<TEntryPoint>

The same builder, configured for a lazy, scenario-owned Azurite container whose connection string is published only after readiness.

Type Parameters

TEntryPoint

The application entry-point type configured by the host builder.

UseKafka(TestScenarioScopeBuilder)

Adds a Kafka container to one scenario.

public static TestScenarioScopeBuilder UseKafka(this TestScenarioScopeBuilder builder)

Parameters

builder TestScenarioScopeBuilder

The non-null scenario-scope builder to configure.

Returns

TestScenarioScopeBuilder

The same builder, configured with resource name Kafka and configuration key Kafka:BootstrapServers.

UseKafka(TestScenarioScopeBuilder, Action<TestcontainerModuleOptions<KafkaBuilder>>)

Adds a configured Kafka container to one scenario.

public static TestScenarioScopeBuilder UseKafka(this TestScenarioScopeBuilder builder, Action<TestcontainerModuleOptions<KafkaBuilder>> configure)

Parameters

builder TestScenarioScopeBuilder

The non-null scenario-scope builder to configure.

configure Action<TestcontainerModuleOptions<KafkaBuilder>>

A non-null callback invoked synchronously once to change names or add native Kafka builder transformations. Transformations run once when the scenario creates its container.

Returns

TestScenarioScopeBuilder

The same builder, configured for a lazy, scenario-owned Kafka container whose bootstrap address is published after readiness.

UseKafka<TEntryPoint>(EasyTestHostBuilder<TEntryPoint>)

Adds a Kafka container to every scenario.

public static EasyTestHostBuilder<TEntryPoint> UseKafka<TEntryPoint>(this EasyTestHostBuilder<TEntryPoint> builder) where TEntryPoint : class

Parameters

builder EasyTestHostBuilder<TEntryPoint>

The non-null host builder to configure.

Returns

EasyTestHostBuilder<TEntryPoint>

The same builder, configured to create a Kafka container named Kafka per scenario and publish its bootstrap address as Kafka:BootstrapServers.

Type Parameters

TEntryPoint

The application entry-point type configured by the host builder.

UseKafka<TEntryPoint>(EasyTestHostBuilder<TEntryPoint>, Action<TestcontainerModuleOptions<KafkaBuilder>>)

Adds a configured Kafka container to every scenario.

public static EasyTestHostBuilder<TEntryPoint> UseKafka<TEntryPoint>(this EasyTestHostBuilder<TEntryPoint> builder, Action<TestcontainerModuleOptions<KafkaBuilder>> configure) where TEntryPoint : class

Parameters

builder EasyTestHostBuilder<TEntryPoint>

The non-null host builder to configure.

configure Action<TestcontainerModuleOptions<KafkaBuilder>>

A non-null callback invoked synchronously once to change the resource name, configuration key, or add native Kafka builder transformations. Transformations run once per scenario.

Returns

EasyTestHostBuilder<TEntryPoint>

The same builder, configured for a lazy, scenario-owned Kafka container whose bootstrap address is published only after readiness.

Type Parameters

TEntryPoint

The application entry-point type configured by the host builder.

UsePostgreSql(TestScenarioScopeBuilder)

Adds a PostgreSQL container to one scenario.

public static TestScenarioScopeBuilder UsePostgreSql(this TestScenarioScopeBuilder builder)

Parameters

builder TestScenarioScopeBuilder

The non-null scenario-scope builder to configure.

Returns

TestScenarioScopeBuilder

The same builder, configured with resource name PostgreSql and configuration key ConnectionStrings:PostgreSql.

UsePostgreSql(TestScenarioScopeBuilder, Action<TestcontainerModuleOptions<PostgreSqlBuilder>>)

Adds a configured PostgreSQL container to one scenario.

public static TestScenarioScopeBuilder UsePostgreSql(this TestScenarioScopeBuilder builder, Action<TestcontainerModuleOptions<PostgreSqlBuilder>> configure)

Parameters

builder TestScenarioScopeBuilder

The non-null scenario-scope builder to configure.

configure Action<TestcontainerModuleOptions<PostgreSqlBuilder>>

A non-null callback invoked synchronously once to change names or add native PostgreSQL builder transformations. Transformations run once when the scenario creates its container.

Returns

TestScenarioScopeBuilder

The same builder, configured for a lazy, scenario-owned PostgreSQL container whose connection string is published after readiness.

UsePostgreSql<TEntryPoint>(EasyTestHostBuilder<TEntryPoint>)

Adds a PostgreSQL container to every scenario.

public static EasyTestHostBuilder<TEntryPoint> UsePostgreSql<TEntryPoint>(this EasyTestHostBuilder<TEntryPoint> builder) where TEntryPoint : class

Parameters

builder EasyTestHostBuilder<TEntryPoint>

The non-null host builder to configure.

Returns

EasyTestHostBuilder<TEntryPoint>

The same builder, configured to create a PostgreSQL container named PostgreSql per scenario and publish its connection string as ConnectionStrings:PostgreSql.

Type Parameters

TEntryPoint

The application entry-point type configured by the host builder.

UsePostgreSql<TEntryPoint>(EasyTestHostBuilder<TEntryPoint>, Action<TestcontainerModuleOptions<PostgreSqlBuilder>>)

Adds a configured PostgreSQL container to every scenario.

public static EasyTestHostBuilder<TEntryPoint> UsePostgreSql<TEntryPoint>(this EasyTestHostBuilder<TEntryPoint> builder, Action<TestcontainerModuleOptions<PostgreSqlBuilder>> configure) where TEntryPoint : class

Parameters

builder EasyTestHostBuilder<TEntryPoint>

The non-null host builder to configure.

configure Action<TestcontainerModuleOptions<PostgreSqlBuilder>>

A non-null callback invoked synchronously once to change the resource name, configuration key, or add native PostgreSQL builder transformations. Native transformations run once per scenario.

Returns

EasyTestHostBuilder<TEntryPoint>

The same builder, configured for a lazy, scenario-owned PostgreSQL container whose connection string is published only after the native readiness strategy succeeds.

Type Parameters

TEntryPoint

The application entry-point type configured by the host builder.

UseRabbitMq(TestScenarioScopeBuilder)

Adds a RabbitMQ container to one scenario.

public static TestScenarioScopeBuilder UseRabbitMq(this TestScenarioScopeBuilder builder)

Parameters

builder TestScenarioScopeBuilder

The non-null scenario-scope builder to configure.

Returns

TestScenarioScopeBuilder

The same builder, configured with resource name RabbitMq and configuration key ConnectionStrings:RabbitMq.

UseRabbitMq(TestScenarioScopeBuilder, Action<TestcontainerModuleOptions<RabbitMqBuilder>>)

Adds a configured RabbitMQ container to one scenario.

public static TestScenarioScopeBuilder UseRabbitMq(this TestScenarioScopeBuilder builder, Action<TestcontainerModuleOptions<RabbitMqBuilder>> configure)

Parameters

builder TestScenarioScopeBuilder

The non-null scenario-scope builder to configure.

configure Action<TestcontainerModuleOptions<RabbitMqBuilder>>

A non-null callback invoked synchronously once to change names or add native RabbitMQ builder transformations. Transformations run once when the scenario creates its container.

Returns

TestScenarioScopeBuilder

The same builder, configured for a lazy, scenario-owned RabbitMQ container whose connection string is published after readiness.

UseRabbitMq<TEntryPoint>(EasyTestHostBuilder<TEntryPoint>)

Adds a RabbitMQ container to every scenario.

public static EasyTestHostBuilder<TEntryPoint> UseRabbitMq<TEntryPoint>(this EasyTestHostBuilder<TEntryPoint> builder) where TEntryPoint : class

Parameters

builder EasyTestHostBuilder<TEntryPoint>

The non-null host builder to configure.

Returns

EasyTestHostBuilder<TEntryPoint>

The same builder, configured to create a RabbitMQ container named RabbitMq per scenario and publish its connection string as ConnectionStrings:RabbitMq.

Type Parameters

TEntryPoint

The application entry-point type configured by the host builder.

UseRabbitMq<TEntryPoint>(EasyTestHostBuilder<TEntryPoint>, Action<TestcontainerModuleOptions<RabbitMqBuilder>>)

Adds a configured RabbitMQ container to every scenario.

public static EasyTestHostBuilder<TEntryPoint> UseRabbitMq<TEntryPoint>(this EasyTestHostBuilder<TEntryPoint> builder, Action<TestcontainerModuleOptions<RabbitMqBuilder>> configure) where TEntryPoint : class

Parameters

builder EasyTestHostBuilder<TEntryPoint>

The non-null host builder to configure.

configure Action<TestcontainerModuleOptions<RabbitMqBuilder>>

A non-null callback invoked synchronously once to change the resource name, configuration key, or add native RabbitMQ builder transformations. Transformations run once per scenario.

Returns

EasyTestHostBuilder<TEntryPoint>

The same builder, configured for a lazy, scenario-owned RabbitMQ container whose connection string is published only after readiness.

Type Parameters

TEntryPoint

The application entry-point type configured by the host builder.

UseRedis(TestScenarioScopeBuilder)

Adds a Redis container to one scenario.

public static TestScenarioScopeBuilder UseRedis(this TestScenarioScopeBuilder builder)

Parameters

builder TestScenarioScopeBuilder

The non-null scenario-scope builder to configure.

Returns

TestScenarioScopeBuilder

The same builder, configured with resource name Redis and configuration key ConnectionStrings:Redis.

UseRedis(TestScenarioScopeBuilder, Action<TestcontainerModuleOptions<RedisBuilder>>)

Adds a configured Redis container to one scenario.

public static TestScenarioScopeBuilder UseRedis(this TestScenarioScopeBuilder builder, Action<TestcontainerModuleOptions<RedisBuilder>> configure)

Parameters

builder TestScenarioScopeBuilder

The non-null scenario-scope builder to configure.

configure Action<TestcontainerModuleOptions<RedisBuilder>>

A non-null callback invoked synchronously once to change names or add native Redis builder transformations. Transformations run once when the scenario creates its container.

Returns

TestScenarioScopeBuilder

The same builder, configured for a lazy, scenario-owned Redis container whose connection string is published after readiness.

UseRedis<TEntryPoint>(EasyTestHostBuilder<TEntryPoint>)

Adds a Redis container to every scenario.

public static EasyTestHostBuilder<TEntryPoint> UseRedis<TEntryPoint>(this EasyTestHostBuilder<TEntryPoint> builder) where TEntryPoint : class

Parameters

builder EasyTestHostBuilder<TEntryPoint>

The non-null host builder to configure.

Returns

EasyTestHostBuilder<TEntryPoint>

The same builder, configured to create a Redis container named Redis per scenario and publish its connection string as ConnectionStrings:Redis.

Type Parameters

TEntryPoint

The application entry-point type configured by the host builder.

UseRedis<TEntryPoint>(EasyTestHostBuilder<TEntryPoint>, Action<TestcontainerModuleOptions<RedisBuilder>>)

Adds a configured Redis container to every scenario.

public static EasyTestHostBuilder<TEntryPoint> UseRedis<TEntryPoint>(this EasyTestHostBuilder<TEntryPoint> builder, Action<TestcontainerModuleOptions<RedisBuilder>> configure) where TEntryPoint : class

Parameters

builder EasyTestHostBuilder<TEntryPoint>

The non-null host builder to configure.

configure Action<TestcontainerModuleOptions<RedisBuilder>>

A non-null callback invoked synchronously once to change the resource name, configuration key, or add native Redis builder transformations. Transformations run once per scenario.

Returns

EasyTestHostBuilder<TEntryPoint>

The same builder, configured for a lazy, scenario-owned Redis container whose connection string is published only after readiness.

Type Parameters

TEntryPoint

The application entry-point type configured by the host builder.

UseServiceBusEmulator(TestScenarioScopeBuilder, Action<TestcontainerModuleOptions<ServiceBusBuilder>>)

Adds a configured Azure Service Bus emulator container to one scenario.

public static TestScenarioScopeBuilder UseServiceBusEmulator(this TestScenarioScopeBuilder builder, Action<TestcontainerModuleOptions<ServiceBusBuilder>> configure)

Parameters

builder TestScenarioScopeBuilder

The non-null scenario-scope builder to configure.

configure Action<TestcontainerModuleOptions<ServiceBusBuilder>>

A non-null callback invoked synchronously once to change names or add native Service Bus builder transformations. Transformations run once when the scenario creates its container. The caller is responsible for configuring required license acceptance on the native builder.

Returns

TestScenarioScopeBuilder

The same builder, configured for a lazy, scenario-owned Service Bus emulator whose connection string is published after readiness.

UseServiceBusEmulator(TestScenarioScopeBuilder, bool)

Adds an Azure Service Bus emulator container to one scenario.

public static TestScenarioScopeBuilder UseServiceBusEmulator(this TestScenarioScopeBuilder builder, bool acceptLicenseAgreement)

Parameters

builder TestScenarioScopeBuilder

The non-null scenario-scope builder to configure.

acceptLicenseAgreement bool

true only when the caller accepts the emulator's license terms; false leaves them unaccepted and can prevent container startup.

Returns

TestScenarioScopeBuilder

The same builder, configured with resource name ServiceBus and configuration key ConnectionStrings:ServiceBus.

UseServiceBusEmulator<TEntryPoint>(EasyTestHostBuilder<TEntryPoint>, Action<TestcontainerModuleOptions<ServiceBusBuilder>>)

Adds a configured Azure Service Bus emulator container to every scenario.

public static EasyTestHostBuilder<TEntryPoint> UseServiceBusEmulator<TEntryPoint>(this EasyTestHostBuilder<TEntryPoint> builder, Action<TestcontainerModuleOptions<ServiceBusBuilder>> configure) where TEntryPoint : class

Parameters

builder EasyTestHostBuilder<TEntryPoint>

The non-null host builder to configure.

configure Action<TestcontainerModuleOptions<ServiceBusBuilder>>

A non-null callback invoked synchronously once to change the resource name, configuration key, or add native Service Bus builder transformations. Transformations run once per scenario. The caller is responsible for configuring required license acceptance on the native builder.

Returns

EasyTestHostBuilder<TEntryPoint>

The same builder, configured for a lazy, scenario-owned Service Bus emulator whose connection string is published only after readiness.

Type Parameters

TEntryPoint

The application entry-point type configured by the host builder.

UseServiceBusEmulator<TEntryPoint>(EasyTestHostBuilder<TEntryPoint>, bool)

Adds an Azure Service Bus emulator container to every scenario.

public static EasyTestHostBuilder<TEntryPoint> UseServiceBusEmulator<TEntryPoint>(this EasyTestHostBuilder<TEntryPoint> builder, bool acceptLicenseAgreement) where TEntryPoint : class

Parameters

builder EasyTestHostBuilder<TEntryPoint>

The non-null host builder to configure.

acceptLicenseAgreement bool

true only when the caller accepts the emulator's license terms; false leaves them unaccepted and can prevent container startup.

Returns

EasyTestHostBuilder<TEntryPoint>

The same builder, configured to create a Service Bus emulator named ServiceBus per scenario and publish its connection string as ConnectionStrings:ServiceBus.

Type Parameters

TEntryPoint

The application entry-point type configured by the host builder.

UseSqlServer(TestScenarioScopeBuilder)

Adds a SQL Server container to one scenario.

public static TestScenarioScopeBuilder UseSqlServer(this TestScenarioScopeBuilder builder)

Parameters

builder TestScenarioScopeBuilder

The non-null scenario-scope builder to configure.

Returns

TestScenarioScopeBuilder

The same builder, configured with resource name SqlServer and configuration key ConnectionStrings:SqlServer.

UseSqlServer(TestScenarioScopeBuilder, Action<TestcontainerModuleOptions<MsSqlBuilder>>)

Adds a configured SQL Server container to one scenario.

public static TestScenarioScopeBuilder UseSqlServer(this TestScenarioScopeBuilder builder, Action<TestcontainerModuleOptions<MsSqlBuilder>> configure)

Parameters

builder TestScenarioScopeBuilder

The non-null scenario-scope builder to configure.

configure Action<TestcontainerModuleOptions<MsSqlBuilder>>

A non-null callback invoked synchronously once to change names or add native SQL Server builder transformations. Transformations run once when the scenario creates its container.

Returns

TestScenarioScopeBuilder

The same builder, configured for a lazy, scenario-owned SQL Server container whose connection string is published after readiness.

UseSqlServer<TEntryPoint>(EasyTestHostBuilder<TEntryPoint>)

Adds a SQL Server container to every scenario.

public static EasyTestHostBuilder<TEntryPoint> UseSqlServer<TEntryPoint>(this EasyTestHostBuilder<TEntryPoint> builder) where TEntryPoint : class

Parameters

builder EasyTestHostBuilder<TEntryPoint>

The non-null host builder to configure.

Returns

EasyTestHostBuilder<TEntryPoint>

The same builder, configured to create a SQL Server container named SqlServer per scenario and publish its connection string as ConnectionStrings:SqlServer.

Type Parameters

TEntryPoint

The application entry-point type configured by the host builder.

UseSqlServer<TEntryPoint>(EasyTestHostBuilder<TEntryPoint>, Action<TestcontainerModuleOptions<MsSqlBuilder>>)

Adds a configured SQL Server container to every scenario.

public static EasyTestHostBuilder<TEntryPoint> UseSqlServer<TEntryPoint>(this EasyTestHostBuilder<TEntryPoint> builder, Action<TestcontainerModuleOptions<MsSqlBuilder>> configure) where TEntryPoint : class

Parameters

builder EasyTestHostBuilder<TEntryPoint>

The non-null host builder to configure.

configure Action<TestcontainerModuleOptions<MsSqlBuilder>>

A non-null callback invoked synchronously once to change the resource name, configuration key, or add native SQL Server builder transformations. Transformations run once per scenario.

Returns

EasyTestHostBuilder<TEntryPoint>

The same builder, configured for a lazy, scenario-owned SQL Server container whose connection string is published only after readiness.

Type Parameters

TEntryPoint

The application entry-point type configured by the host builder.