Partial matching

This commit is contained in:
Stef Heyenrath
2017-02-04 17:30:16 +01:00
parent 9b99a7f26b
commit ec2d105db2
19 changed files with 343 additions and 83 deletions

View File

@@ -53,16 +53,28 @@ namespace WireMock.Matchers.Request
/// Determines whether the specified RequestMessage is match.
/// </summary>
/// <param name="requestMessage">The RequestMessage.</param>
/// <param name="requestMatchResult">The RequestMatchResult.</param>
/// <returns>
/// <c>true</c> if the specified RequestMessage is match; otherwise, <c>false</c>.
/// </returns>
public bool IsMatch(RequestMessage requestMessage)
public bool IsMatch(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
{
bool isMatch = IsMatch(requestMessage);
if (isMatch)
requestMatchResult.Matched++;
requestMatchResult.Total++;
return isMatch;
}
private bool IsMatch(RequestMessage requestMessage)
{
if (Matchers != null)
return Matchers.Any(matcher => matcher.IsMatch(requestMessage.Path));
if (Funcs != null)
return Funcs.Any(func => func(requestMessage.Path));
return requestMessage.Path != null && Funcs.Any(func => func(requestMessage.Path));
return false;
}