This commit is contained in:
Stef Heyenrath
2018-03-10 15:50:34 +01:00
parent f604be3c02
commit ff012be173
9 changed files with 107 additions and 34 deletions

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Lightweight StandAlone Http Mocking Server for .Net.</Description>
<AssemblyTitle>WireMock.Net.StandAlone</AssemblyTitle>
<Version>1.0.3.7</Version>
<Version>1.0.3.8</Version>
<Authors>Stef Heyenrath</Authors>
<TargetFrameworks>net452;net46;netstandard1.3;netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

View File

@@ -65,9 +65,15 @@ namespace WireMock.Matchers.Request
return MatchScores.ToScore(requestMessage.Query != null && Funcs.Any(f => f(requestMessage.Query)));
}
List<string> values = requestMessage.GetParameter(Key);
var values = requestMessage.GetParameter(Key);
if (values == null && !Values.Any())
{
// Key is present, but no values, just return match
return MatchScores.Perfect;
}
return MatchScores.ToScore(values?.Intersect(Values).Count() == Values.Count());
var matches = Values.Select(v => values != null && values.Contains(v));
return MatchScores.ToScore(matches);
}
}
}

View File

@@ -180,10 +180,11 @@ namespace WireMock
queryString = queryString.Substring(1);
}
return queryString.Split('&').Aggregate(new Dictionary<string, WireMockList<string>>(),
return queryString.Split(new[] { '&' }, StringSplitOptions.RemoveEmptyEntries)
.Aggregate(new Dictionary<string, WireMockList<string>>(),
(dict, term) =>
{
var parts = term.Split('=');
string[] parts = term.Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
string key = parts[0];
if (!dict.ContainsKey(key))
{
@@ -192,7 +193,8 @@ namespace WireMock
if (parts.Length == 2)
{
dict[key].Add(parts[1]);
string[] values = parts[1].Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
dict[key].AddRange(values);
}
return dict;

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Lightweight Http Mocking Server for .Net, inspired by WireMock from the Java landscape.</Description>
<AssemblyTitle>WireMock.Net</AssemblyTitle>
<Version>1.0.3.7</Version>
<Version>1.0.3.8</Version>
<Authors>Alexandre Victoor;Stef Heyenrath</Authors>
<TargetFrameworks>net452;net46;netstandard1.3;netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>