I am trying to implement PactNet contract tests on our provider project. However the issue is that we are using a Minimal API so instead of having a Startup.cs and Program.cs class we just have it all rolled into one Program.cs.
This poses an issue, as previously I would have been able to run Host.CreateDefaultBuilder
and pass it the Startup
class, as demonstrated in the PactNet samples. All the examples of doing something similar that I've run across on SO use TestServer
or WebApplicationFactory
, which are inapplicable in this scenario since they start an in-memory server, and I need a server running on a real TCP socket, so that PactNets Rust internals can communicate with it.
The only solution I've managed to find is to just manually run the provider with dotnet run
however this feels hackish, and I would much prefer to do it programmatically as previously was possible with Host.CreateDefaultBuilder
.