mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-16 15:16:53 +01:00
* Add TIOBE + include SonarAnalyzer.CSharp * . * cp * Copyright © WireMock.Net * more fixes * fix * xpath * if (Matchers == null || !Matchers.Any()) * if (Matchers != null) * ? * . * .
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
// Copyright © WireMock.Net
|
|
|
|
#if NET6_0_OR_GREATER
|
|
using System;
|
|
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 adminUsername = $"username_{Guid.NewGuid()}";
|
|
var adminPassword = $"password_{Guid.NewGuid()}";
|
|
var wireMockContainer = new WireMockContainerBuilder()
|
|
.WithAutoRemove(true)
|
|
.WithCleanUp(true)
|
|
.WithAdminUserNameAndPassword(adminUsername, adminPassword)
|
|
.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 |