mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-21 00:11:44 +02:00
FindLogEntries (#1224)
This commit is contained in:
@@ -15,6 +15,7 @@ using RestEase;
|
||||
using WireMock.Client;
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Logging;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
@@ -258,7 +259,7 @@ public class WireMockServerAdminTests
|
||||
|
||||
// Assert
|
||||
var mapping = server.Mappings.First(m => !m.IsAdminInterface);
|
||||
var request = (Request) mapping.RequestMatcher;
|
||||
var request = (Request)mapping.RequestMatcher;
|
||||
var pathMatcher = request.GetRequestMessageMatcher<RequestMessagePathMatcher>();
|
||||
pathMatcher.Should().BeNull();
|
||||
|
||||
@@ -428,6 +429,34 @@ public class WireMockServerAdminTests
|
||||
server.Stop();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WireMockServer_Admin_Logging_FindLogEntries()
|
||||
{
|
||||
// Assign
|
||||
using var client = new HttpClient();
|
||||
|
||||
// Act
|
||||
using var server = WireMockServer.Start();
|
||||
|
||||
var tasks = new[]
|
||||
{
|
||||
client.GetAsync($"{server.Url}/foo1"),
|
||||
client.PostAsync($"{server.Url}/foo2", new StringContent("test")),
|
||||
client.GetAsync($"{server.Url}/foo3")
|
||||
};
|
||||
|
||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
|
||||
// Act
|
||||
var logEntries = server.FindLogEntries(new RequestMessageMethodMatcher("GET"));
|
||||
|
||||
// Assert
|
||||
logEntries.Should().HaveCount(2);
|
||||
|
||||
logEntries.Single(le => le.RequestMessage.Path.EndsWith("foo1")).Should().NotBeNull();
|
||||
logEntries.Single(le => le.RequestMessage.Path.EndsWith("foo3")).Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireMockServer_Admin_WatchStaticMappings()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user