mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 13:00:33 +01:00
Page:
Pact
Pages
Admin API Reference
Compatibility WireMock.org
Conflict on Microsoft.CodeAnalysis.CSharp
Cors
Could not load file or assembly RestEase
Development Information
Faults
FluentAssertions
Home
KestrelServerOptions
Mapping
MimeKit and MimeKitLite
MyGet preview versions
Pact
Proxying
References
RegexExtended
Request Matcher FormUrlEncodedMatcher
Request Matchers
Request Matching CSharpCode
Request Matching GraphQLMatcher
Request Matching JsonMatcher
Request Matching JsonPartialMatcher
Request Matching JsonPartialWildcardMatcher
Request Matching JsonPathMatcher
Request Matching MimePartMatcher
Request Matching ProtoBuf
Request Matching Tips
Request Matching
Response Templating
Scenarios and States
Settings
Stubbing
Using HTTPS (SSL)
Using WireMock in UnitTests
Using WireMock.Net.Aspire
Using WireMock.Net.Testcontainers
Webhook
What Is WireMock.Net
WireMock as a (Azure) Web App
WireMock as a Windows Service
WireMock as a standalone process
WireMock as dotnet tool
WireMock commandline parameters
WireMock.Org
Xamarin Could not load file or assembly
Clone
1
Pact
Stef Heyenrath edited this page 2022-04-22 16:14:29 +02:00
Pact(flow)
Pactflow. Contract testing for teams. Make the most of your contract testing initiative. Now you can run, maintain and fix integration issues with more ease than ever before. Pactflow is compatible with the Pact consumer driven contract testing framework and now also supports you to put your favourite tools to work with our Bi-Directional Contract Testing feature.
WireMock.Net support
WireMock.Net has some support for Pact:
Save the existing mappings to a Pact V2 json file:
var server = WireMockServer.Start();
server
.WithConsumer("Something API Consumer Get")
.WithProvider("Something API")
.Given(Request.Create()
.UsingGet()
.WithPath("/tester")
.WithParam("q1", "test")
.WithParam("q2", "ok")
.WithHeader("Accept", "application/json")
)
.WithTitle("A GET request to retrieve the something")
.RespondWith(
Response.Create()
.WithStatusCode(HttpStatusCode.OK)
.WithHeader("Content-Type", "application/json; charset=utf-8")
.WithBodyAsJson(new
{
Id = "tester",
FirstName = "Totally",
LastName = "Awesome"
})
);
server.SavePact(Path.Combine("../../../", "Pact", "files"), "pact-get.json");
Will produce this Pact Json file:
{
"Consumer": {
"Name": "Something API Consumer Get"
},
"Interactions": [
{
"ProviderState": "A GET request to retrieve the something",
"Request": {
"Headers": {
"Accept": "application/json"
},
"Method": "GET",
"Path": "/tester",
"Query": "q1=test&q2=ok"
},
"Response": {
"Body": {
"Id": "tester",
"FirstName": "Totally",
"LastName": "Awesome"
},
"Headers": {
"Content-Type": "application/json; charset=utf-8"
},
"Status": 200
}
}
],
"Provider": {
"Name": "Something API"
}
}
Examples
Pages
- Home
- What is WireMock.Net
- WireMock.Org
- References
- Settings
- Admin REST API
- Proxying
- Stubbing
- Webhook
- Request Matching
- Response Templating
- Unit Testing
- Using WireMock
- Advanced
- Errors