mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-01 07:03:29 +02:00
Update WireMockContainerBuilder (WithImage and WithCustomImage) (#1391)
* Update WireMockContainerBuilder (WithImage and WithCustomImage) * .
This commit is contained in:
@@ -62,6 +62,29 @@ public sealed class WireMockContainerBuilder : ContainerBuilder<WireMockContaine
|
|||||||
return WithImage(OSPlatform.Windows);
|
return WithImage(OSPlatform.Windows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets a custom WireMock.Net image for which to create the container.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="image">The image name.</param>
|
||||||
|
/// <returns>A configured instance of <see cref="WireMockContainerBuilder"/></returns>
|
||||||
|
[PublicAPI]
|
||||||
|
public new WireMockContainerBuilder WithImage(string image)
|
||||||
|
{
|
||||||
|
return WithCustomImage(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets a custom WireMock.Net image for which to create the container.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="image">The image name.</param>
|
||||||
|
/// <returns>A configured instance of <see cref="WireMockContainerBuilder"/></returns>
|
||||||
|
[PublicAPI]
|
||||||
|
public WireMockContainerBuilder WithCustomImage(string image)
|
||||||
|
{
|
||||||
|
_imageOS ??= TestcontainersUtils.GetImageOSAsync.Value.GetAwaiter().GetResult();
|
||||||
|
return base.WithImage(image);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the admin username and password for the container (basic authentication).
|
/// Set the admin username and password for the container (basic authentication).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public partial class TestcontainersTests(ITestOutputHelper testOutputHelper)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wireMockContainerBuilder = wireMockContainerBuilder.WithImage("sheyenrath/wiremock.net");
|
wireMockContainerBuilder = wireMockContainerBuilder.WithImage("sheyenrath/wiremock.net-alpine");
|
||||||
}
|
}
|
||||||
|
|
||||||
var wireMockContainer = wireMockContainerBuilder.Build();
|
var wireMockContainer = wireMockContainerBuilder.Build();
|
||||||
|
|||||||
Reference in New Issue
Block a user