diff --git a/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj b/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj
index 24b402a4..f52bc3c4 100644
--- a/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj
+++ b/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj
@@ -29,15 +29,12 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
-
-
-
-
+
\ No newline at end of file
diff --git a/src/WireMock.Net.Testcontainers/WireMockConfiguration.cs b/src/WireMock.Net.Testcontainers/WireMockConfiguration.cs
index 3403eca1..56a91f7e 100644
--- a/src/WireMock.Net.Testcontainers/WireMockConfiguration.cs
+++ b/src/WireMock.Net.Testcontainers/WireMockConfiguration.cs
@@ -16,10 +16,7 @@ public sealed class WireMockConfiguration : ContainerConfiguration
public bool HasBasicAuthentication => !string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password);
- public WireMockConfiguration(
- string? username = null,
- string? password = null
- )
+ public WireMockConfiguration(string? username = null, string? password = null)
{
Username = username;
Password = password;
diff --git a/src/WireMock.Net.Testcontainers/WireMockContainerBuilder.cs b/src/WireMock.Net.Testcontainers/WireMockContainerBuilder.cs
index d724b0e6..fbbb9f0f 100644
--- a/src/WireMock.Net.Testcontainers/WireMockContainerBuilder.cs
+++ b/src/WireMock.Net.Testcontainers/WireMockContainerBuilder.cs
@@ -25,6 +25,11 @@ public sealed class WireMockContainerBuilder : ContainerBuilder> _isWindowsAsLazy = new(async () =>
{
+ if (TestcontainersSettings.OS.DockerEndpointAuthConfig == null)
+ {
+ throw new InvalidOperationException($"The {nameof(TestcontainersSettings.OS.DockerEndpointAuthConfig)} is null. Check if Docker is started.");
+ }
+
using var dockerClientConfig = TestcontainersSettings.OS.DockerEndpointAuthConfig.GetDockerClientConfiguration();
using var dockerClient = dockerClientConfig.CreateClient();
diff --git a/test/WireMock.Net.Tests/Testcontainers/TestcontainersTests.cs b/test/WireMock.Net.Tests/Testcontainers/TestcontainersTests.cs
new file mode 100644
index 00000000..27ac9b43
--- /dev/null
+++ b/test/WireMock.Net.Tests/Testcontainers/TestcontainersTests.cs
@@ -0,0 +1,43 @@
+#if NET6_0_OR_GREATER
+using System.Threading.Tasks;
+using FluentAssertions;
+using FluentAssertions.Execution;
+using WireMock.Net.Testcontainers;
+using Xunit;
+
+namespace WireMock.Net.Tests.Testcontainers;
+
+public class TestcontainersTests
+{
+ [Fact]
+ public async Task WireMockContainer_Build_and_StartAsync_and_StopAsync()
+ {
+ // Act
+ var wireMockContainer = new WireMockContainerBuilder()
+ .WithAutoRemove(true)
+ .WithCleanUp(true)
+ .Build();
+
+ try
+ {
+ await wireMockContainer.StartAsync().ConfigureAwait(false);
+
+ // Assert
+ using (new AssertionScope())
+ {
+ var url = wireMockContainer.GetPublicUrl();
+ url.Should().NotBeNullOrWhiteSpace();
+
+ var adminClient = wireMockContainer.CreateWireMockAdminClient();
+
+ var settings = await adminClient.GetSettingsAsync();
+ settings.Should().NotBeNull();
+ }
+ }
+ finally
+ {
+ await wireMockContainer.StopAsync();
+ }
+ }
+}
+#endif
\ No newline at end of file
diff --git a/test/WireMock.Net.Tests/WireMock.Net.Tests.csproj b/test/WireMock.Net.Tests/WireMock.Net.Tests.csproj
index 0a585d41..07d32aed 100644
--- a/test/WireMock.Net.Tests/WireMock.Net.Tests.csproj
+++ b/test/WireMock.Net.Tests/WireMock.Net.Tests.csproj
@@ -105,6 +105,10 @@
+
+
+
+
PreserveNewest