mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-22 17:19:00 +01:00
Update + add fluent builder methods (#1042)
* Update some fluent builder methods * fix * sc * ThenRespondWith * // Copyright © WireMock.Net
This commit is contained in:
@@ -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§ions=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§ions=personal%2Corganizations%2Cemployment");
|
||||
|
||||
Reference in New Issue
Block a user