var config = new PactConfig
{
PactDir = @"c:\contractDemoNew\pacts",
Outputters = new[]
{
new XunitOutput(output)
},
DefaultJsonSettings = new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
PropertyNameCaseInsensitive = true,
Converters = { new JsonStringEnumConverter() }
},
LogLevel = PactLogLevel.Debug
};
b
Bas Dijkstra
07/30/2024, 1:28 PM
Hey @piyush jain , this is better suited for #C9UTHV2AD I guess.
And no, I don’t think you can. It doesn’t really matter, because publishing the contract is better suited to be a step that is separated from running tests.
To make things easier, there’s https://github.com/pact-foundation/pact_broker-client for local and CI use
p
piyush jain
07/30/2024, 2:40 PM
Hi @Bas Dijkstra: I have a radius/pact-broker running on the local machine (Docker). I can push the pact with the API . I am using Pact NET 4X. and Do I need to setup pact_broker-client as well? with Pact-Net 2X there was a way to publish it like :
var pactPublisher = new PactPublisher("http://<YOUR_BROKER>.pactflow.io",
new PactUriOptions("<TOKEN>"));
pactPublisher.PublishToBroker("/pact/to/pacts/dir",
Environment.GetEnvironmentVariable("GIT_COMMIT"));
I don’t know. I wasn’t aware that this class existed in older versions. If it’s not there in Pact .Net 4.x the change logs will probably tell you if and why it was removed.
I’ve not seen any examples using
PactPublisher
that I can remember.
m
Matt (pactflow.io / pact-js / pact-go)
07/30/2024, 9:57 PM
We recommend using the pact CLI tools for this job.
We made a decision a few years ago to not support all of the CLI functions in each language because it's just added maintenance work