mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-08-20 02:34:15 +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?
|
||||
var rowRange = Enumerable.Range(0, matchers.Length);
|
||||
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?
|
||||
|
||||
@@ -554,9 +554,10 @@ public class WireMockListTests
|
||||
{
|
||||
// Arrange
|
||||
var list = new WireMockList<string>("a", "b");
|
||||
var sameReference = list;
|
||||
|
||||
// Act & Assert
|
||||
list.Equals(list).Should().BeTrue();
|
||||
list.Equals(sameReference).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -566,7 +567,7 @@ public class WireMockListTests
|
||||
var list = new WireMockList<string>("a");
|
||||
|
||||
// Act & Assert
|
||||
list.Equals(null).Should().BeFalse();
|
||||
list.Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -169,7 +169,7 @@ public class FormUrlEncodedMatcherTest
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task FormUrlEncodedMatcher_IsMatch_And_MatchAllProperties_Test_1()
|
||||
public async Task FormUrlEncodedMatcher_IsMatch_And_MatchAllProperties_MissingRequiredKey_ShouldNotMatch()
|
||||
{
|
||||
// Arrange
|
||||
var content = new FormUrlEncodedContent(
|
||||
@@ -191,7 +191,7 @@ public class FormUrlEncodedMatcherTest
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task FormUrlEncodedMatcher_IsMatch_And_MatchAllProperties_Test_2()
|
||||
public async Task FormUrlEncodedMatcher_IsMatch_And_MatchAllProperties_ConflictingEmailPatterns_ShouldNotMatch()
|
||||
{
|
||||
// Arrange
|
||||
var content = new FormUrlEncodedContent(
|
||||
|
||||
@@ -355,8 +355,9 @@ public partial class WireMockServerTests
|
||||
);
|
||||
|
||||
// Act
|
||||
var content = new FormUrlEncodedContent([new KeyValuePair<string, string>("key1", "value1")]);
|
||||
var response = await new HttpClient()
|
||||
using var content = new FormUrlEncodedContent([new KeyValuePair<string, string>("key1", "value1")]);
|
||||
using var httpClient = new HttpClient();
|
||||
var response = await httpClient
|
||||
.PostAsync($"{server.Url}/foo", content, _ct);
|
||||
|
||||
// Assert
|
||||
@@ -374,15 +375,16 @@ public partial class WireMockServerTests
|
||||
Request.Create()
|
||||
.UsingPost()
|
||||
.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(
|
||||
Response.Create()
|
||||
);
|
||||
|
||||
// Act
|
||||
var content = new FormUrlEncodedContent([new KeyValuePair<string, string>("key1", "value1")]);
|
||||
var response = await new HttpClient()
|
||||
using var content = new FormUrlEncodedContent([new KeyValuePair<string, string>("key1", "value1")]);
|
||||
using var httpClient = new HttpClient();
|
||||
var response = await httpClient
|
||||
.PostAsync($"{server.Url}/foo", content, _ct);
|
||||
|
||||
// Assert
|
||||
|
||||
Reference in New Issue
Block a user