Skip to content

Commit

Permalink
sc
Browse files Browse the repository at this point in the history
  • Loading branch information
StefH committed Dec 16, 2023
1 parent 124959b commit 3f370f3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 31 deletions.
28 changes: 14 additions & 14 deletions src/WireMock.Net/Server/IRespondWithAProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,27 @@ public interface IRespondWithAProvider
/// <returns>The <see cref="IRespondWithAProvider"/>.</returns>
IRespondWithAProvider WithGuid(Guid guid);

/// <summary>
/// Define a unique identifier for this mapping.
/// </summary>
/// <param name="guid">The unique identifier.</param>
/// <returns>The <see cref="IRespondWithAProvider"/>.</returns>
IRespondWithAProvider WithGuid(string guid);

/// <summary>
/// Define a unique identifier for this mapping.
/// </summary>
/// <param name="guid">The unique identifier.</param>
/// <returns>The <see cref="IRespondWithAProvider"/>.</returns>
IRespondWithAProvider DefineGuid(Guid guid);

/// <summary>
/// Define a unique identifier for this mapping.
/// </summary>
/// <param name="guid">The unique identifier.</param>
/// <returns>The <see cref="IRespondWithAProvider"/>.</returns>
IRespondWithAProvider DefineGuid(string guid);

/// <summary>
/// Define the TimeSettings for this mapping.
/// </summary>
Expand Down Expand Up @@ -61,20 +75,6 @@ public interface IRespondWithAProvider
/// <returns>The <see cref="IRespondWithAProvider"/>.</returns>
IRespondWithAProvider WithPath(string path);

/// <summary>
/// Define a unique identifier for this mapping.
/// </summary>
/// <param name="guid">The unique identifier.</param>
/// <returns>The <see cref="IRespondWithAProvider"/>.</returns>
IRespondWithAProvider WithGuid(string guid);

/// <summary>
/// Define a unique identifier for this mapping.
/// </summary>
/// <param name="guid">The unique identifier.</param>
/// <returns>The <see cref="IRespondWithAProvider"/>.</returns>
IRespondWithAProvider DefineGuid(string guid);

/// <summary>
/// Define the priority for this mapping.
/// </summary>
Expand Down
14 changes: 7 additions & 7 deletions src/WireMock.Net/Server/RespondWithAProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,6 @@ public IRespondWithAProvider WithGuid(string guid)
return WithGuid(Guid.Parse(guid));
}

/// <inheritdoc />
public IRespondWithAProvider DefineGuid(string guid)
{
return WithGuid(guid);
}

/// <inheritdoc />
public IRespondWithAProvider WithGuid(Guid guid)
{
Expand All @@ -173,6 +167,12 @@ public IRespondWithAProvider DefineGuid(Guid guid)
return WithGuid(guid);
}

/// <inheritdoc />
public IRespondWithAProvider DefineGuid(string guid)
{
return WithGuid(guid);
}

/// <inheritdoc />
public IRespondWithAProvider WithTitle(string title)
{
Expand All @@ -189,7 +189,7 @@ public IRespondWithAProvider WithDescription(string description)
return this;
}

/// <see cref="IRespondWithAProvider.WithPath"/>
/// <inheritdoc />
public IRespondWithAProvider WithPath(string path)
{
_path = path;
Expand Down
2 changes: 1 addition & 1 deletion src/WireMock.Net/Server/WireMockServer.Fluent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public IRespondWithAProvider Given(IRequestMatcher requestMatcher, bool saveToFi
/// <param name="saveToFile">Optional boolean to indicate if this mapping should be saved as static mapping file.</param>
/// <returns>The <see cref="IRespondWithAProvider"/>.</returns>
[PublicAPI]
public IRespondWithAProvider WithRequest(Action<IRequestBuilder> action, bool saveToFile = false)
public IRespondWithAProvider WhenRequest(Action<IRequestBuilder> action, bool saveToFile = false)
{
Guard.NotNull(action);

Expand Down
14 changes: 5 additions & 9 deletions test/WireMock.Net.Tests/WireMockServerTests.WithParam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async Task WireMockServer_WithParam_QueryParameterMultipleValueSupport_No
};
var server = WireMockServer.Start(settings);
server
.WithRequest(r => r
.WhenRequest(r => r
.UsingGet()
.WithPath("/foo")
.WithParam("query", queryValue)
Expand All @@ -53,12 +53,12 @@ public async Task WireMockServer_WithParam_MultiValueComma()
var queryValue = "1,2,3";
var server = WireMockServer.Start();
server
.WithRequest(r => r
.WhenRequest(r => r
.UsingGet()
.WithPath("/foo")
.WithParam("query", "1", "2", "3")
)
.RespondWithOK();
.RespondWithStatusCode(200);

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

// Act
var requestUri = new Uri($"http://localhost:{server.Port}/v1/person/workers?showsourcesystem=true&count=700&page=1&sections=personal%2Corganizations%2Cemployment");
Expand All @@ -106,9 +104,7 @@ public async Task WireMockServer_WithParam_AcceptOnMatch_OnNonMatchingParam_Shou
.WithParam("delta_from")
.UsingGet()
)
.RespondWith(
Response.Create()
);
.RespondWithStatusCode("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 3f370f3

Please sign in to comment.