mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-17 23:14:23 +01:00
Add more tests for JmesPathMatchers and StringUtils.ParseMatchOperator (#1009)
* Add more tests for JmesPathMatchers and StringUtils.ParseMatchOperator * . * prio
This commit is contained in:
@@ -35,11 +35,7 @@ internal class MappingMatcher : IMappingMatcher
|
||||
{
|
||||
var nextState = GetNextState(mapping);
|
||||
|
||||
var mappingMatcherResult = new MappingMatcherResult
|
||||
{
|
||||
Mapping = mapping,
|
||||
RequestMatchResult = mapping.GetRequestMatchResult(request, nextState)
|
||||
};
|
||||
var mappingMatcherResult = new MappingMatcherResult(mapping, mapping.GetRequestMatchResult(request, nextState));
|
||||
|
||||
var exceptions = mappingMatcherResult.RequestMatchResult.MatchDetails
|
||||
.Where(md => md.Exception != null)
|
||||
@@ -66,7 +62,10 @@ internal class MappingMatcher : IMappingMatcher
|
||||
|
||||
var partialMappings = possibleMappings
|
||||
.Where(pm => (pm.Mapping.IsAdminInterface && pm.RequestMatchResult.IsPerfectMatch) || !pm.Mapping.IsAdminInterface)
|
||||
.OrderBy(m => m.RequestMatchResult).ThenBy(m => m.Mapping.Priority).ThenByDescending(m => m.Mapping.UpdatedAt)
|
||||
.OrderBy(m => m.RequestMatchResult)
|
||||
.ThenBy(m => m.RequestMatchResult.TotalNumber)
|
||||
.ThenBy(m => m.Mapping.Priority)
|
||||
.ThenByDescending(m => m.Mapping.UpdatedAt)
|
||||
.ToList();
|
||||
var partialMatch = partialMappings.FirstOrDefault(pm => pm.RequestMatchResult.AverageTotalScore > 0.0);
|
||||
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
using Stef.Validation;
|
||||
using WireMock.Matchers.Request;
|
||||
|
||||
namespace WireMock.Owin;
|
||||
|
||||
internal class MappingMatcherResult
|
||||
{
|
||||
public IMapping Mapping { get; set; }
|
||||
public IMapping Mapping { get; }
|
||||
|
||||
public IRequestMatchResult RequestMatchResult { get; set; }
|
||||
public IRequestMatchResult RequestMatchResult { get; }
|
||||
|
||||
public MappingMatcherResult(IMapping mapping, IRequestMatchResult requestMatchResult)
|
||||
{
|
||||
Mapping = Guard.NotNull(mapping);
|
||||
RequestMatchResult = Guard.NotNull(requestMatchResult);
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public interface IRespondWithAProvider
|
||||
/// <summary>
|
||||
/// Define the priority for this mapping.
|
||||
/// </summary>
|
||||
/// <param name="priority">The priority.</param>
|
||||
/// <param name="priority">The priority. (A lower value means a higher priority.)</param>
|
||||
/// <returns>The <see cref="IRespondWithAProvider"/>.</returns>
|
||||
IRespondWithAProvider AtPriority(int priority);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user