Updated Stubbing (markdown)

Stef Heyenrath
2017-02-13 18:17:52 +01:00
parent 8127b27538
commit ea0abde8c6

@@ -103,16 +103,46 @@ Will match xml below:
The RegexMatcher can be used to match using a regular expression.
```csharp
// todo example
var server = FluentMockServer.Start();
server
.Given(
Request.Create().WithPath("/reg").UsingGet()
.WithBody(new RegexMatcher("H.*o"));
)
.RespondWith(Response.WithBody("Hello matched with RegexMatcher"));
```
```
// matching
Hello World
// not matching
Hi WM
```
### Similarity Metric Matching
[SimMetrics.Net](https://github.com/StefH/SimMetrics.Net) is used as a Similarity Metric Library, e.g. from edit distance's (Levenshtein, Gotoh, Jaro etc) to other metrics, (e.g Soundex, Chapman).
```csharp
// todo example
var server = FluentMockServer.Start();
server
.AllowPartialMatching()
.Given(
Request.Create().WithPath("/reg").UsingGet()
.WithBody(new SimMetricsMatcher("The cat walks in the street."));
)
.RespondWith(Response.WithBody("Matched with SimMetricsMatcher"));
```
```
// matching with distance 0.793
The car drives in the street.
// matching with distance 0.071
Hello
```
### WildcardMatching
WildcardMatching is mostly used for Path and Url matching. This matcher allows a ? for a single character and * for any characters.