| | | 1 | | namespace WireMock.Matchers |
| | | 2 | | { |
| | | 3 | | internal static class MatchBehaviourHelper |
| | | 4 | | { |
| | | 5 | | /// <summary> |
| | | 6 | | /// Converts the specified match behaviour and match value to a new match value. |
| | | 7 | | /// |
| | | 8 | | /// if AcceptOnMatch --> return match (default) |
| | | 9 | | /// if RejectOnMatch and match = 0.0 --> return 1.0 |
| | | 10 | | /// if RejectOnMatch and match = 0.? --> return 0.0 |
| | | 11 | | /// if RejectOnMatch and match = 1.0 --> return 0.0 |
| | | 12 | | /// </summary> |
| | | 13 | | /// |
| | | 14 | | /// <param name="matchBehaviour">The match behaviour.</param> |
| | | 15 | | /// <param name="match">The match.</param> |
| | | 16 | | /// <returns>match value</returns> |
| | | 17 | | internal static double Convert(MatchBehaviour matchBehaviour, double match) |
| | 758 | 18 | | { |
| | 758 | 19 | | if (matchBehaviour == MatchBehaviour.AcceptOnMatch) |
| | 740 | 20 | | { |
| | 740 | 21 | | return match; |
| | | 22 | | } |
| | | 23 | | |
| | 18 | 24 | | return match <= MatchScores.Tolerance ? MatchScores.Perfect : MatchScores.Mismatch; |
| | 758 | 25 | | } |
| | | 26 | | } |
| | | 27 | | } |