From fd816f0952b9fef0351a8c0eee42c6f01f0b85e3 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Sat, 12 Aug 2023 21:05:13 +0200 Subject: [PATCH] Add extra unit test for WithParam multiple values comma (#992) --- .../WireMockServerTests.WithParam.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/WireMock.Net.Tests/WireMockServerTests.WithParam.cs b/test/WireMock.Net.Tests/WireMockServerTests.WithParam.cs index f4d9fcf1..8f70eb65 100644 --- a/test/WireMock.Net.Tests/WireMockServerTests.WithParam.cs +++ b/test/WireMock.Net.Tests/WireMockServerTests.WithParam.cs @@ -16,6 +16,7 @@ public partial class WireMockServerTests [Theory] [InlineData("SELECT id, value FROM table WHERE id = 1")] [InlineData("select id, name, value from table where id in (1, 2, 3, 4, 5)")] + [InlineData("1,2,3")] public async Task WireMockServer_WithParam_QueryParameterMultipleValueSupport_NoComma_Should_Ignore_Comma(string queryValue) { // Arrange @@ -43,4 +44,30 @@ public partial class WireMockServerTests server.Stop(); } + + [Fact] + public async Task WireMockServer_WithParam_MultiValueComma() + { + // Arrange + var queryValue = "1,2,3"; + var server = WireMockServer.Start(); + server.Given( + Request.Create() + .UsingGet() + .WithPath("/foo") + .WithParam("query", "1", "2", "3") + ) + .RespondWith( + Response.Create().WithStatusCode(200) + ); + + // Act + var requestUri = new Uri($"http://localhost:{server.Port}/foo?query={queryValue}"); + var response = await server.CreateClient().GetAsync(requestUri).ConfigureAwait(false); + + // Assert + response.StatusCode.Should().Be(HttpStatusCode.OK); + + server.Stop(); + } } \ No newline at end of file