mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-21 16:48:59 +01:00
More fixes for #106
This commit is contained in:
@@ -27,6 +27,14 @@ namespace WireMock.Matchers.Request
|
||||
/// </summary>
|
||||
public IEnumerable<string> Values { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequestMessageParamMatcher"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
public RequestMessageParamMatcher([NotNull] string key) : this(key, null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequestMessageParamMatcher"/> class.
|
||||
/// </summary>
|
||||
@@ -66,13 +74,19 @@ namespace WireMock.Matchers.Request
|
||||
}
|
||||
|
||||
var values = requestMessage.GetParameter(Key);
|
||||
if (values == null && !Values.Any())
|
||||
if (values == null)
|
||||
{
|
||||
// Key is present, but no values, just return match
|
||||
// Key is not present, just return Mismatch
|
||||
return MatchScores.Mismatch;
|
||||
}
|
||||
|
||||
if (values.Count == 0 && (Values == null || !Values.Any()))
|
||||
{
|
||||
// Key is present, but no values or null, just return Perfect
|
||||
return MatchScores.Perfect;
|
||||
}
|
||||
|
||||
var matches = Values.Select(v => values != null && values.Contains(v));
|
||||
var matches = Values.Select(v => values.Contains(v));
|
||||
return MatchScores.ToScore(matches);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user