-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fcb8a47
commit 101967d
Showing
5 changed files
with
178 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
namespace EvidenceResolver.Tests.Contract | ||
{ | ||
public static class MockProviderServiceExtenstion | ||
{ | ||
public static IMockProviderService WithRequest(this IMockProviderService mockProviderService, | ||
HttpVerb method, object path, object body = null, Dictionary<string, object> headers = null) | ||
{ | ||
var providerServiceRequest = new ProviderServiceRequest | ||
{ | ||
Method = method, | ||
Path = path | ||
}; | ||
|
||
providerServiceRequest.Headers = headers ?? new Dictionary<string, object> | ||
{ | ||
{"Content-Type", "application/json"} | ||
}; | ||
|
||
if (body != null) { | ||
providerServiceRequest.Body = PactNet.Matchers.Match.Type(body); | ||
} | ||
|
||
return mockProviderService.With(providerServiceRequest); | ||
} | ||
|
||
public static void WillRespondParameters(this IMockProviderService mockProviderService, | ||
int status, dynamic body = null, Dictionary<string, object> headers = null) | ||
{ | ||
if (body == null) { | ||
body = new { }; | ||
} | ||
|
||
var expectedResponse = new ProviderServiceResponse | ||
{ | ||
Status = status, | ||
Headers = headers ?? new Dictionary<string, object> | ||
{{"Content-Type", "application/json; charset=utf-8"}}, | ||
Body = PactNet.Matchers.Match.Type(body) | ||
}; | ||
|
||
mockProviderService.WillRespondWith(expectedResponse); | ||
} | ||
} | ||
} |
Oops, something went wrong.