Open AshleyPoole opened 4 years ago
At the moment I see this as going too much against the philosophy of ComPact. As you say, it's better to be very explicit, or if the response doesn't matter, to just leave it out entirely.
But I'll leave this open to get a sense whether other people feel the same way.
Thanks - The reasoning is because the client class under test, that issues the HTTP request, returns a strongly typed object, so for when writing tests, it would be nice to be able to instantiate an instance of that object and set the values to the expected. Also means if adding or renaming a field in the project, the PACT tests will auto be updated too, ready to be reviewed and committed.
I see. but then again, if your able to share strongly typed objects between consumer and provider you don't really need Pact in the first place ;)
If dealing with a complex object, it would make it easier writing tests if
WithBody()
as part of a response (WillRepondWith
) chain could accept an object to be passed as the expected response for the verification. This would allow Com-Pact to operate similar to Pact.Net. Of course it's better to be very explicit with what is expected but allowing an object to be used as the expected response would allow for tests to be written much faster.