Use try-catch when adding or removing logEntry (#848)

* Use try-catch when removing logEntry

* .

* try catch add

* Add extra check

* ...
This commit is contained in:
Stef Heyenrath
2022-11-21 07:30:27 +01:00
committed by GitHub
parent ef5f988786
commit 38634ac65a
2 changed files with 54 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;
using Moq;
using Newtonsoft.Json;
using NFluent;
@@ -374,6 +375,26 @@ public class WireMockServerAdminTests
server.Stop();
}
[Fact]
public async Task WireMockServer_Admin_Logging_SetMaxRequestLogCount_To_0_Should_Not_AddLogging()
{
// Assign
var client = new HttpClient();
// Act
var server = WireMockServer.Start();
server.SetMaxRequestLogCount(0);
await client.GetAsync("http://localhost:" + server.Port + "/foo1").ConfigureAwait(false);
await client.GetAsync("http://localhost:" + server.Port + "/foo2").ConfigureAwait(false);
await client.GetAsync("http://localhost:" + server.Port + "/foo3").ConfigureAwait(false);
// Assert
server.LogEntries.Should().BeEmpty();
server.Stop();
}
[Fact]
public void WireMockServer_Admin_WatchStaticMappings()
{