prio

Stef Heyenrath
2017-02-01 12:43:43 +01:00
parent 033ce69824
commit 93eca38c39

@@ -138,7 +138,25 @@ All of the standard helpers (template functions) provided by the C# Handlebars i
`{{capitalize request.query.search}}`
## Stub priority
*TODO*
It is sometimes the case that youll want to declare two or more stub mappings that “overlap”, in that a given request would be a match for more than one of them. By default, WireMock.NET will use the most recently added matching stub to satisfy the request. However, in some cases it is useful to exert more control.
One example of this might be where you want to define a catch-all stub for any URL that doesnt match any more specific cases. Adding a priority to a stub mapping facilitates this:
```csharp
var server = FluentMockServer.Start();
// Catch-all case
server
.Given(Request.Create().WithPath("/api/*"))
.AtPriority(100)
.RespondWith(Responses.Create().WithStatusCode(401));
// Specific case
server
.Given(Request.Create().WithPath("/api/specific-resource"))
.AtPriority(1)
.RespondWith(Responses.Create().WithStatusCode(200));
```
## Verify interactions
The server keeps a log of the received requests. You can use this log to verify the interactions that have been done with the server during a test.