Narek Avanesyan
06/13/2023, 7:31 AMclass ResponseModel
{
public NestedModel NestedModel {get; set;}
}
class NestedModel
{
public string Name {get; set;}
}
I have to specify the Name
's value as expected, for example with Request id 123, the Name
is "Andy". I mean, I cannot somehow specify that it is just a string, because pact verifier checks the value (C# is strongly typed language, I cannot assign IMatcher
to a string
).
So when I have to change the expected response to be:
class ResponseModel
{
public NestedModel[] NestedModel {get; set;}
}
I do not know the exact values of the other objects in the array.
So how should I proceed in this situation?Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Narek Avanesyan
06/30/2023, 11:05 AMvar response = new {
JobInfosMap = new Dictionary<IMatcher, IMatcher> {
{Match.Type(900L), Match.Type(new JobInfo{Id = 900, Number = "900", Name = "Clogged Drain", StartDate = DateTime.Parse("6/13/2023 6:00:00 AM")} )}
}
}
the generated pact is:
"jobInfosMap": {
"pactNet.Matchers.TypeMatcher": {
"endDate": null,
"id": 900,
"name": "Clogged Drain",
"number": "900",
"startDate": "2023-06-13T06:00:00Z"
}
},
which means that the key is of type pactNet.Matchers.TypeMatcher
, but the key is of type long
as I define in Match.Type(900L)
.
So how to be with Dictionaries?Tigran Davtyan
06/30/2023, 1:38 PMNarek Avanesyan
06/30/2023, 1:43 PMTigran Davtyan
06/30/2023, 1:48 PMMatt (pactflow.io / pact-js / pact-go)
Narek Avanesyan
07/05/2023, 8:21 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Narek Avanesyan
07/06/2023, 2:28 PMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
EachKey
and EachValue
here: https://github.com/pact-foundation/pact-specification/tree/version-4