Update handlebars code to support Regex.Match (#201) (#202)

* #201

* Handlebars : Linq and JsonPath

* Rename to Regex.Match

* unit test coverage
This commit is contained in:
Stef Heyenrath
2018-09-11 08:42:50 +02:00
committed by GitHub
parent ec39d12cfe
commit da64934c13
11 changed files with 964 additions and 579 deletions

View File

@@ -83,11 +83,13 @@ namespace WireMock.Matchers
// Convert a single object to a Queryable JObject-list with 1 entry.
var queryable1 = new[] { value }.AsQueryable();
// Generate the dynamic linq select statement and generate a dynamic Queryable.
// Generate the DynamicLinq select statement.
string dynamicSelect = JsonUtils.GenerateDynamicLinqStatement(value);
// Execute DynamicLinq Select statement.
var queryable2 = queryable1.Select(dynamicSelect);
// Use the Any(...) method to check if the result matches
// Use the Any(...) method to check if the result matches.
double match = MatchScores.ToScore(_patterns.Select(pattern => queryable2.Any(pattern)));
return MatchBehaviourHelper.Convert(MatchBehaviour, match);