Add extra unit test for WithParam multiple values comma (#992)

This commit is contained in:
Stef Heyenrath
2023-08-12 21:05:13 +02:00
committed by GitHub
parent 205c1d598b
commit fd816f0952

View File

@@ -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();
}
}