mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-11-13 12:23:42 +01:00
* Add .NET 10 target framework Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * ... * add delay * ok * TUnit - delay * 10 * ado * ado - no nuget tests * . * no collect * await Task.Delay(500, _ct); --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
// Copyright © WireMock.Net
|
|
|
|
using WireMock.Net.TUnit;
|
|
using WireMock.RequestBuilders;
|
|
using WireMock.ResponseBuilders;
|
|
using WireMock.Server;
|
|
using WireMock.Settings;
|
|
|
|
namespace WireMock.Net.TUnitTests;
|
|
|
|
// ReSharper disable once InconsistentNaming
|
|
public class TUnitTests
|
|
{
|
|
[Test]
|
|
public async Task Test_TUnitWireMockLogger()
|
|
{
|
|
// Assign
|
|
var path = $"/foo_{Guid.NewGuid()}";
|
|
|
|
using var server = WireMockServer.Start(new WireMockServerSettings
|
|
{
|
|
Logger = new TUnitWireMockLogger(TestContext.Current!.GetDefaultLogger())
|
|
});
|
|
|
|
await Task.Delay(1000, TestContext.Current.Execution.CancellationToken);
|
|
|
|
server
|
|
.Given(Request.Create()
|
|
.WithPath(path)
|
|
.UsingGet())
|
|
.RespondWith(Response.Create().WithBody("TUnit"));
|
|
|
|
// Act
|
|
var response = await server.CreateClient().GetStringAsync($"{server.Url}{path}");
|
|
|
|
// Assert
|
|
await Assert.That(response).IsEqualTo("TUnit");
|
|
}
|
|
} |