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

ClearInteraction when using messaging pacts #479

Closed
singhvivek2503 opened this issue Oct 20, 2023 · 5 comments
Closed

ClearInteraction when using messaging pacts #479

singhvivek2503 opened this issue Oct 20, 2023 · 5 comments

Comments

@singhvivek2503
Copy link

singhvivek2503 commented Oct 20, 2023

I am using messaging pacts to contract test event based communication.
Is there a way similar to _mockProviderServiceInstance.ClearInteractions(); when using messaging pacts?

this.pact = Pact.V4("ConsumerName", "ProviderName", config)
                .WithMessageInteractions();
@mefellows
Copy link
Member

mefellows commented Oct 20, 2023

Why do you think you need to clear them?

@singhvivek2503
Copy link
Author

Why do you need to clear them?

Writing updated versions of old tests and adding new tests. The contract json file preserves the older interactions which I don't need anymore.

@mefellows
Copy link
Member

Why does that matter? You shouldn't be uploading from a dirty development environment anyway.

If you need to clear old interactions, just delete the file

@singhvivek2503
Copy link
Author

Why does that matter? You shouldn't be uploading from a dirty development environment anyway.

If you need to clear old interactions, just delete the file

Ok. Wondering if that's correct, why its there in here _mockProviderServiceInstance.ClearInteractions()?

@adamrodger
Copy link
Contributor

The ClearInteractions method was removed from PactNet in v4.x and is no longer required.

As @mefellows says, you should be starting each test run from a fresh environment with no existing Pact file so that older interactions aren't left behind.

@adamrodger adamrodger closed this as not planned Won't fix, can't repro, duplicate, stale Oct 20, 2023
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

3 participants