Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pact format for regex matcher is not recognized by provider verification test #3

Open
Gokulaprakash opened this issue Jan 3, 2019 · 0 comments

Comments

@Gokulaprakash
Copy link

Gokulaprakash commented Jan 3, 2019

The pact format generated by pact-net-message library looks like below. The matcher format generated is not recognized as matcher by the verfiication and keeps giving me error as Path $.Property1.json_class, expected: Pact::Term, actual:

{
  "provider": {
    "name": "test-provider-amqp"
  },
  "consumer": {
    "name": "test-consumer-amqp"
  },
  "messages": [
    {
      "description": "Verify the payload contract is satisfied",
      "providerState": "Pay load",
      "contents": {
        "EventName": "test.message",
        "Property1": {
          "json_class": "Pact::Term",
          "data": {
            "generate": "83F9262F-28F1-4703-AB1A-8CFD9E8249C9",
            "matcher": {
              "json_class": "Regexp",
              "o": 0,
              "s": "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
            }
          }
        }
      },
      "metaData": {
        "routingKey": "test.message"
      }
    }
  ],
  "metadata": {
    "pactSpecificationVersion": "3.0"
  }
}

Here's the pact generation code:

           var guidRegex = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}";
            var eventName = "test.message";
            var guid = "83F9262F-28F1-4703-AB1A-8CFD9E8249C9";

            dynamic eventData = new
            {
                EventName = eventName,
                Property1 = Match.Regex(guid, guidRegex)
            };

            amqpProvider.PactMessageBuilder.MockMq().Given("Pay load")
                .UponReceiving("Verify the payload contract is satisfied")
                .WithMetaData(new { routingKey = "test.message" })
                .WithContent(eventData);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant