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

Update InvokeVerifiable error message and add negate support #1976

Merged
merged 6 commits into from Jun 23, 2021

Conversation

fflaten
Copy link
Collaborator

@fflaten fflaten commented Jun 6, 2021

PR Summary

Updates InvokeVerifiable assertion with negate support. Should -Not -InvokeVerifiable expects none of the defined verifiable mocks to be called and will fail if any were.

This PR also updates the error message to output all missed (called when -Not) mock behaviors. The previous error message only showed the first missing mock even though Mock command help says it should mention all.

Mocks can be marked Verifiable. If so, the Assert-VerifiableMock command
can be used to check if all Verifiable mocks were actually called. If any
verifiable mock is not called, Should -InvokeVerifiable will throw an
exception and indicate all mocks not called.

Output before PR:
image

Output after PR:
image

Fix #1779

/cc @bchristie

PR Checklist

  • PR has meaningful title
  • Summary describes changes
  • PR is ready to be merged
    • If not, use the arrow next to Create Pull Request to mark it as a draft. PR can be marked Ready for review when it's ready.
  • Tests are added/update (if required)
  • Documentation is updated/added (if required)

@nohwnd nohwnd merged commit 4e3c3e1 into pester:main Jun 23, 2021
@fflaten fflaten deleted the invokeverifiable branch June 24, 2021 10:14
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

Successfully merging this pull request may close these issues.

Should -Not -InvokeVerifiable not working
2 participants