mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-18 23:44:43 +01:00
Fix WireMockContainerBuilder (duplicate entries) (#1222)
This commit is contained in:
19
test/WireMock.Net.Tests/Facts/RunOnDockerPlatformFact.cs
Normal file
19
test/WireMock.Net.Tests/Facts/RunOnDockerPlatformFact.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
// Copyright © WireMock.Net
|
||||
#if NET6_0_OR_GREATER
|
||||
using System.Runtime.InteropServices;
|
||||
using WireMock.Net.Testcontainers.Utils;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Facts;
|
||||
|
||||
public sealed class RunOnDockerPlatformFact : FactAttribute
|
||||
{
|
||||
public RunOnDockerPlatformFact(string platform)
|
||||
{
|
||||
if (TestcontainersUtils.GetImageOSAsync.Value.Result != OSPlatform.Create(platform))
|
||||
{
|
||||
Skip = $"Only run test when Docker OS Platform {platform} is used.";
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -4,9 +4,11 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using DotNet.Testcontainers.Builders;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using WireMock.Net.Testcontainers;
|
||||
using WireMock.Net.Tests.Facts;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Testcontainers;
|
||||
@@ -27,7 +29,27 @@ public class TestcontainersTests
|
||||
|
||||
await StartTestAndStopAsync(wireMockContainer);
|
||||
}
|
||||
|
||||
|
||||
// https://github.com/testcontainers/testcontainers-dotnet/issues/1322
|
||||
[RunOnDockerPlatformFact("Linux")]
|
||||
public async Task WireMockContainer_Build_WithNoImageAndNetwork_And_StartAsync_and_StopAsync()
|
||||
{
|
||||
// Act
|
||||
var dummyNetwork = new NetworkBuilder()
|
||||
.WithName("Dummy Network for TestcontainersTests")
|
||||
.WithCleanUp(true)
|
||||
.Build();
|
||||
|
||||
var wireMockContainer = new WireMockContainerBuilder()
|
||||
.WithNetwork(dummyNetwork)
|
||||
.WithWatchStaticMappings(true)
|
||||
.WithAutoRemove(true)
|
||||
.WithCleanUp(true)
|
||||
.Build();
|
||||
|
||||
await StartTestAndStopAsync(wireMockContainer);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WireMockContainer_Build_WithImage_And_StartAsync_and_StopAsync()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user