mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-02-16 07:17:42 +01:00
* ProtoBuf
* .
* x
* ---
* x
* fx
* ...
* sc
* ...
* .
* groen
* x
* fix tests
* ok!?
* fix tests
* fix tests
* !
* x
* 6
* .
* x
* ivaluematcher
* transformer
* .
* sc
* .
* mapping
* x
* tra
* com
* ...
* .
* .
* .
* AddProtoDefinition
* .
* set
* grpahj
* .
* .
* IdOrText
* ...
* async
* async2
* .
* t
* nuget
* <PackageReference Include="ProtoBufJsonConverter" Version="0.2.0-preview-04" />
* http version
* tests
* .WithHttpVersion("2")
* <PackageReference Include="ProtoBufJsonConverter" Version="0.2.0" />
* HttpVersionParser
33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
namespace WireMock.Matchers;
|
|
|
|
internal static class MatchBehaviourHelper
|
|
{
|
|
/// <summary>
|
|
/// Converts the specified match behaviour and match value to a new match value.
|
|
///
|
|
/// if AcceptOnMatch --> return match (default)
|
|
/// if RejectOnMatch and match = 0.0 --> return 1.0
|
|
/// if RejectOnMatch and match = 0.? --> return 0.0
|
|
/// if RejectOnMatch and match = 1.0 --> return 0.0
|
|
/// </summary>
|
|
///
|
|
/// <param name="matchBehaviour">The match behaviour.</param>
|
|
/// <param name="match">The match.</param>
|
|
/// <returns>match value</returns>
|
|
internal static double Convert(MatchBehaviour matchBehaviour, double match)
|
|
{
|
|
if (matchBehaviour == MatchBehaviour.AcceptOnMatch)
|
|
{
|
|
return match;
|
|
}
|
|
|
|
return match <= MatchScores.Tolerance ? MatchScores.Perfect : MatchScores.Mismatch;
|
|
}
|
|
|
|
internal static MatchResult Convert(MatchBehaviour matchBehaviour, MatchResult result)
|
|
{
|
|
return matchBehaviour == MatchBehaviour.AcceptOnMatch ?
|
|
result :
|
|
new MatchResult(Convert(matchBehaviour, result.Score), result.Exception);
|
|
}
|
|
} |