I new pact testing, I have a pact consumer test in which a property can have any value from a defined set of string:
this.pact
.ExpectsToReceive("an event indicating that an order has been created")
.WithJsonContent(new
{
PayloadType = Match.MinType(new List<string> { "apple", "orange" }, 1),
})
Not sure how to match PayloadType
to have one value either "apple" or "orange". Please guide.
I used Match.Regex
to achieve matching strings:
this.pact
.ExpectsToReceive("an event indicating that an order has been created")
.WithJsonContent(new
{
PayloadType = Match.Regex("apple", ("apple|orange")),
})