mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-08-24 12:24:08 +02:00
Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Copilot Autofix powered by AI
parent
48792c7b7b
commit
0809c1888f
@@ -96,7 +96,6 @@ public static class MatchScores
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For each value, how well was it matched by its best matcher?
|
// For each value, how well was it matched by its best matcher?
|
||||||
var rowRange = Enumerable.Range(0, matchers.Length);
|
|
||||||
var rowScore = matchOperator == MatchOperator.And ? matrix.Average(row => row.Max()) : matrix.Max(row => row.Max());
|
var rowScore = matchOperator == MatchOperator.And ? matrix.Average(row => row.Max()) : matrix.Max(row => row.Max());
|
||||||
|
|
||||||
// For each matcher, how well was it satisfied by its best value?
|
// For each matcher, how well was it satisfied by its best value?
|
||||||
|
|||||||
@@ -554,9 +554,10 @@ public class WireMockListTests
|
|||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var list = new WireMockList<string>("a", "b");
|
var list = new WireMockList<string>("a", "b");
|
||||||
|
var sameReference = list;
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
list.Equals(list).Should().BeTrue();
|
list.Equals(sameReference).Should().BeTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -566,7 +567,7 @@ public class WireMockListTests
|
|||||||
var list = new WireMockList<string>("a");
|
var list = new WireMockList<string>("a");
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
list.Equals(null).Should().BeFalse();
|
list.Should().NotBeNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ public class FormUrlEncodedMatcherTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task FormUrlEncodedMatcher_IsMatch_And_MatchAllProperties_Test_1()
|
public async Task FormUrlEncodedMatcher_IsMatch_And_MatchAllProperties_MissingRequiredKey_ShouldNotMatch()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var content = new FormUrlEncodedContent(
|
var content = new FormUrlEncodedContent(
|
||||||
@@ -191,7 +191,7 @@ public class FormUrlEncodedMatcherTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task FormUrlEncodedMatcher_IsMatch_And_MatchAllProperties_Test_2()
|
public async Task FormUrlEncodedMatcher_IsMatch_And_MatchAllProperties_ConflictingEmailPatterns_ShouldNotMatch()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var content = new FormUrlEncodedContent(
|
var content = new FormUrlEncodedContent(
|
||||||
|
|||||||
@@ -355,8 +355,9 @@ public partial class WireMockServerTests
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var content = new FormUrlEncodedContent([new KeyValuePair<string, string>("key1", "value1")]);
|
using var content = new FormUrlEncodedContent([new KeyValuePair<string, string>("key1", "value1")]);
|
||||||
var response = await new HttpClient()
|
using var httpClient = new HttpClient();
|
||||||
|
var response = await httpClient
|
||||||
.PostAsync($"{server.Url}/foo", content, _ct);
|
.PostAsync($"{server.Url}/foo", content, _ct);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
@@ -374,15 +375,16 @@ public partial class WireMockServerTests
|
|||||||
Request.Create()
|
Request.Create()
|
||||||
.UsingPost()
|
.UsingPost()
|
||||||
.WithPath("/foo")
|
.WithPath("/foo")
|
||||||
.WithBody((IDictionary<string, WireMockList<string>>? values) => values != null && values["key1"] == "value1")
|
.WithBody((IDictionary<string, WireMockList<string>>? values) => values != null && values.TryGetValue("key1", out var v) && v == "value1")
|
||||||
)
|
)
|
||||||
.RespondWith(
|
.RespondWith(
|
||||||
Response.Create()
|
Response.Create()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var content = new FormUrlEncodedContent([new KeyValuePair<string, string>("key1", "value1")]);
|
using var content = new FormUrlEncodedContent([new KeyValuePair<string, string>("key1", "value1")]);
|
||||||
var response = await new HttpClient()
|
using var httpClient = new HttpClient();
|
||||||
|
var response = await httpClient
|
||||||
.PostAsync($"{server.Url}/foo", content, _ct);
|
.PostAsync($"{server.Url}/foo", content, _ct);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|||||||
Reference in New Issue
Block a user