Update + add fluent builder methods (#1042)

* Update some fluent builder methods

* fix

* sc

* ThenRespondWith

* // Copyright © WireMock.Net
This commit is contained in:
Stef Heyenrath
2024-07-27 16:16:11 +02:00
committed by GitHub
parent 275816c414
commit 69c829fae0
6 changed files with 168 additions and 41 deletions

View File

@@ -28,14 +28,14 @@ public partial class WireMockServerTests
QueryParameterMultipleValueSupport = QueryParameterMultipleValueSupport.NoComma
};
var server = WireMockServer.Start(settings);
server.Given(
Request.Create()
server
.WhenRequest(r => r
.UsingGet()
.WithPath("/foo")
.WithParam("query", queryValue)
)
.RespondWith(
Response.Create().WithStatusCode(200)
.ThenRespondWith(r => r
.WithStatusCode(HttpStatusCode.Accepted)
);
// Act
@@ -43,7 +43,7 @@ public partial class WireMockServerTests
var response = await server.CreateClient().GetAsync(requestUri).ConfigureAwait(false);
// Assert
response.StatusCode.Should().Be(HttpStatusCode.OK);
response.StatusCode.Should().Be(HttpStatusCode.Accepted);
server.Stop();
}
@@ -54,15 +54,13 @@ public partial class WireMockServerTests
// Arrange
var queryValue = "1,2,3";
var server = WireMockServer.Start();
server.Given(
Request.Create()
server
.WhenRequest(r => r
.UsingGet()
.WithPath("/foo")
.WithParam("query", "1", "2", "3")
)
.RespondWith(
Response.Create().WithStatusCode(200)
);
.ThenRespondWithStatusCode(200);
// Act
var requestUri = new Uri($"http://localhost:{server.Port}/foo?query={queryValue}");
@@ -85,9 +83,7 @@ public partial class WireMockServerTests
.WithParam("delta_from", MatchBehaviour.RejectOnMatch)
.UsingGet()
)
.RespondWith(
Response.Create()
);
.ThenRespondWithOK();
// Act
var requestUri = new Uri($"http://localhost:{server.Port}/v1/person/workers?showsourcesystem=true&count=700&page=1&sections=personal%2Corganizations%2Cemployment");
@@ -110,9 +106,7 @@ public partial class WireMockServerTests
.WithParam("delta_from")
.UsingGet()
)
.RespondWith(
Response.Create()
);
.ThenRespondWithStatusCode("300");
// Act
var requestUri = new Uri($"http://localhost:{server.Port}/v1/person/workers?showsourcesystem=true&count=700&page=1&sections=personal%2Corganizations%2Cemployment");