pact-net
pact-net copied to clipboard
Update workshop v3 // update link
The README still has a link to this old workshop, which is quite outdated relative to the current status of this project.
Ideally, this workshop is updated to reflect the latest/greatest things.
Should we (in the mean time) remove the link?
See also https://github.com/DiUS/pact-workshop-dotnet-core-v3/issues/1#issuecomment-1141763721.
I don't think it's all that outdated (the general API usage is correct and the flow is right) but it definitely needs some work. Some problems I can see:
- Using an alpha version of PactNet from an Artifactory instance instead of latest from nuget.org
- The tests use
async void
instead ofasync Task
- Using
.GetAwaiter().GetResult()
from a syncMain
instead of making it async - The mock server uses a hard-coded port, which is not recommended, and then creates the
HttpClient
once using that port. It's recommended to create theHttpClient
inside theVerifyAsync
lambda using the URI from the verification context - The diagrams are SVGs with transparent backgrounds and black text, which can't be seen in dark mode
- There are some typo/style problems, such as the Authorization section has one test embedded inside another because of a missed closing brace
Well, I agree with all that - which is why I'm raising it ;)
We get quite a few comments/issues on that workshop and it seems to be a cause of confusion. I'm finding myself pointing people back to your examples/docs because they are up to date.e I think we should bring the workshop into the foundation (especially now the awesome 4.x.x is live 🙌 ), what do you think?
cc: @YOU54F for visibility. I don't think there is much work to do to bring it up to speed, would be a great one to see if we can get some community contributors on.
I don't think it's all that outdated (the general API usage is correct and the flow is right) but it definitely needs some work. Some problems I can see:
- [x] Using an alpha version of PactNet from an Artifactory instance instead of latest from nuget.org
- [x] The tests use
async void
instead ofasync Task
- [x] Using
.GetAwaiter().GetResult()
from a syncMain
instead of making it async- [x] The mock server uses a hard-coded port, which is not recommended, and then creates the
HttpClient
once using that port. It's recommended to create theHttpClient
inside theVerifyAsync
lambda using the URI from the verification context- [ ] The diagrams are SVGs with transparent backgrounds and black text, which can't be seen in dark mode
- [ ] There are some typo/style problems, such as the Authorization section has one test embedded inside another because of a missed closing brace
https://github.com/DiUS/pact-workshop-dotnet-core-v3/pull/7
also updated to net6.0
and changed to minimal api
and removed all unused classes.
Awesome @riezebosch - thanks for casting your eyes over and even more thanks for your PR! Will bring it to attention of the team and take it for a spin 👍🏾
Amazing! Thanks.
I think with the SVGs, we could just save them and remove transparency - that would be the simplest thing.
Thanks @riezebosch for kicking this off
To all Pact-netizens, got some goodies for you, wouldn't mind some eyes across them :)
- Updated https://github.com/pactflow/example-consumer-dotnet to use pact-net 4.x / .NET 6.0 and branches/environments/record deployments over tags
- Updated https://github.com/pactflow/example-provider-dotnet to use pact-net 4.x / .NET 6.0 and branches/environments/record deployments over tags
- Added a PR to update the v1 workshop https://github.com/pact-foundation/pact-workshop-dotnet-core-v1/pull/25
- Added a PR to update the v3 workshop https://github.com/DiUS/pact-workshop-dotnet-core-v3/pull/8
I think we may in the very near future, to consolidate all the things.
- rename https://github.com/pact-foundation/pact-workshop-dotnet-core-v1 to pact-workshop-dotnet
- canonical example from https://github.com/DiUS/pact-workshop-dotnet-core-v3/pull/8 becomes the main course
- sub foldered (probably easier than branches) workshop for https://github.com/pact-foundation/pact-workshop-dotnet-core-v1/pull/25
- we can then add additional examples for x framework
- Minimal API https://github.com/DiUS/pact-workshop-dotnet-core-v3/pulls
- Update all the links to point at the renamed https://github.com/pact-foundation/pact-workshop-dotnet
PS. I have to say, the DSL is pact-net 4.x is quite nice, and the delta between 3.x -> 4.x isn't bad at all, especially once you've got one test converted, the rest is relatively plain sailing.