mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-29 03:37:03 +02:00
Added X509Certificate2Filename (#27)
This commit is contained in:
@@ -43,25 +43,12 @@ namespace WireMock.Matchers.Request
|
||||
/// </returns>
|
||||
public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
|
||||
{
|
||||
var list = new List<double>();
|
||||
if (_type == CompositeMatcherType.And)
|
||||
{
|
||||
foreach (var requestMatcher in RequestMatchers)
|
||||
{
|
||||
double score = requestMatcher.GetMatchingScore(requestMessage, requestMatchResult);
|
||||
list.Add(score);
|
||||
}
|
||||
|
||||
return list.Sum() / list.Count;
|
||||
}
|
||||
|
||||
foreach (var requestMatcher in RequestMatchers)
|
||||
{
|
||||
double score = requestMatcher.GetMatchingScore(requestMessage, requestMatchResult);
|
||||
list.Add(score);
|
||||
return RequestMatchers.Average(requestMatcher => requestMatcher.GetMatchingScore(requestMessage, requestMatchResult));
|
||||
}
|
||||
|
||||
return list.Max();
|
||||
return RequestMatchers.Max(requestMatcher => requestMatcher.GetMatchingScore(requestMessage, requestMatchResult));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using System.Linq;
|
||||
using System.Xml;
|
||||
using JetBrains.Annotations;
|
||||
using WireMock.Validation;
|
||||
#if NET45
|
||||
#if !NETSTANDARD
|
||||
using Wmhelp.XPath2;
|
||||
#endif
|
||||
|
||||
@@ -41,10 +41,10 @@ namespace WireMock.Matchers
|
||||
try
|
||||
{
|
||||
var nav = new XmlDocument { InnerXml = input }.CreateNavigator();
|
||||
#if NET45
|
||||
return MatchScores.ToScore(_patterns.Select(p => true.Equals(nav.XPath2Evaluate($"boolean({p})"))));
|
||||
#else
|
||||
#if NETSTANDARD
|
||||
return MatchScores.ToScore(_patterns.Select(p => true.Equals(nav.Evaluate($"boolean({p})"))));
|
||||
#else
|
||||
return MatchScores.ToScore(_patterns.Select(p => true.Equals(nav.XPath2Evaluate($"boolean({p})"))));
|
||||
#endif
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -65,9 +65,7 @@ namespace WireMock.Matchers
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// Name
|
||||
/// </returns>
|
||||
/// <returns>Name</returns>
|
||||
public string GetName()
|
||||
{
|
||||
return "XPathMatcher";
|
||||
|
||||
Reference in New Issue
Block a user