Skip to content

Commit

Permalink
ThenRespondWith
Browse files Browse the repository at this point in the history
  • Loading branch information
StefH committed Dec 16, 2023
1 parent 3f370f3 commit 4174e6c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/WireMock.Net/Server/IRespondWithAProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,33 +92,33 @@ public interface IRespondWithAProvider
/// RespondWith
/// </summary>
/// <param name="action">The action to use the fluent <see cref="IResponseBuilder"/>.</param>
void RespondWith(Action<IResponseBuilder> action);
void ThenRespondWith(Action<IResponseBuilder> action);

/// <summary>
/// RespondWith a status code 200 (OK);
/// </summary>
void RespondWithOK();
void ThenRespondWithOK();

/// <summary>
/// RespondWith a status code.
/// By default all status codes are allowed, to change this behaviour, see <inheritdoc cref="WireMockServerSettings.AllowOnlyDefinedHttpStatusCodeInResponse"/>.
/// </summary>
/// <param name="code">The code.</param>
void RespondWithStatusCode(int code);
void ThenRespondWithStatusCode(int code);

/// <summary>
/// RespondWith a status code.
/// By default all status codes are allowed, to change this behaviour, see <inheritdoc cref="WireMockServerSettings.AllowOnlyDefinedHttpStatusCodeInResponse"/>.
/// </summary>
/// <param name="code">The code.</param>
void RespondWithStatusCode(string code);
void ThenRespondWithStatusCode(string code);

/// <summary>
/// RespondWith a status code.
/// By default all status codes are allowed, to change this behaviour, see <inheritdoc cref="WireMockServerSettings.AllowOnlyDefinedHttpStatusCodeInResponse"/>.
/// </summary>
/// <param name="code">The code.</param>
void RespondWithStatusCode(HttpStatusCode code);
void ThenRespondWithStatusCode(HttpStatusCode code);

/// <summary>
/// Sets the the scenario.
Expand Down
10 changes: 5 additions & 5 deletions src/WireMock.Net/Server/RespondWithAProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void RespondWith(IResponseProvider provider)
}

/// <inheritdoc />
public void RespondWith(Action<IResponseBuilder> action)
public void ThenRespondWith(Action<IResponseBuilder> action)
{
var responseBuilder = Response.Create();

Expand All @@ -109,31 +109,31 @@ public void RespondWith(Action<IResponseBuilder> action)
}

/// <inheritdoc />
public void RespondWithOK()
public void ThenRespondWithOK()
{
var responseBuilder = Response.Create();

RespondWith(responseBuilder);
}

/// <inheritdoc />
public void RespondWithStatusCode(int code)
public void ThenRespondWithStatusCode(int code)
{
var responseBuilder = Response.Create().WithStatusCode(code);

RespondWith(responseBuilder);
}

/// <inheritdoc />
public void RespondWithStatusCode(string code)
public void ThenRespondWithStatusCode(string code)
{
var responseBuilder = Response.Create().WithStatusCode(code);

RespondWith(responseBuilder);
}

/// <inheritdoc />
public void RespondWithStatusCode(HttpStatusCode code)
public void ThenRespondWithStatusCode(HttpStatusCode code)
{
var responseBuilder = Response.Create().WithStatusCode(code);

Expand Down
8 changes: 4 additions & 4 deletions test/WireMock.Net.Tests/WireMockServerTests.WithParam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task WireMockServer_WithParam_QueryParameterMultipleValueSupport_No
.WithPath("/foo")
.WithParam("query", queryValue)
)
.RespondWith(r => r
.ThenRespondWith(r => r
.WithStatusCode(HttpStatusCode.Accepted)
);

Expand All @@ -58,7 +58,7 @@ public async Task WireMockServer_WithParam_MultiValueComma()
.WithPath("/foo")
.WithParam("query", "1", "2", "3")
)
.RespondWithStatusCode(200);
.ThenRespondWithStatusCode(200);

// Act
var requestUri = new Uri($"http://localhost:{server.Port}/foo?query={queryValue}");
Expand All @@ -81,7 +81,7 @@ public async Task WireMockServer_WithParam_RejectOnMatch_OnNonMatchingParam_Shou
.WithParam("delta_from", MatchBehaviour.RejectOnMatch)
.UsingGet()
)
.RespondWithOK();
.ThenRespondWithOK();

// Act
var requestUri = new Uri($"http://localhost:{server.Port}/v1/person/workers?showsourcesystem=true&count=700&page=1&sections=personal%2Corganizations%2Cemployment");
Expand All @@ -104,7 +104,7 @@ public async Task WireMockServer_WithParam_AcceptOnMatch_OnNonMatchingParam_Shou
.WithParam("delta_from")
.UsingGet()
)
.RespondWithStatusCode("300");
.ThenRespondWithStatusCode("300");

// Act
var requestUri = new Uri($"http://localhost:{server.Port}/v1/person/workers?showsourcesystem=true&count=700&page=1&sections=personal%2Corganizations%2Cemployment");
Expand Down

0 comments on commit 4174e6c

Please sign in to comment.