-
-
Notifications
You must be signed in to change notification settings - Fork 802
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
Add setup.Verifiable(Times times, [string failMessage])
method
#1319
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stakx
changed the title
Add setup.Verifiable(Times times, [string failMessage]) method
Add Dec 30, 2022
setup.Verifiable(Times times, [string failMessage])
method
stakx
force-pushed
the
verifiable-times
branch
2 times, most recently
from
December 31, 2022 11:44
50d2c4f
to
c75cb6b
Compare
This was referenced Dec 31, 2022
Closed
stakx
force-pushed
the
verifiable-times
branch
from
December 31, 2022 17:52
c75cb6b
to
4def3a5
Compare
When this is going to released? |
I'd love to do a release but I'm currently blocked from doing so by #1340. |
This feature has been monumental in allowing us to migrate from NMock to Moq without rewriting 3000+ tests to the AAA style. @stakx We'd be incredibly grateful if you could create a new release :') |
vbreuss
referenced
this pull request
in Testably/Testably.Architecture.Rules
Aug 8, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [Moq](https://togithub.com/moq/moq) | nuget | minor | `4.18.4` -> `4.20.0` | --- ### Release Notes <details> <summary>moq/moq (Moq)</summary> ### [`v4.20.0`](https://togithub.com/moq/moq/releases/tag/v4.20.0) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### ✨ Implemented enhancements - Add `setup.Verifiable(Times times, [string failMessage])` method by [@​stakx](https://togithub.com/stakx) in [https://github.com/moq/moq/pull/1319](https://togithub.com/moq/moq/pull/1319) ##### 🔨 Other - Add `Mock<T>.RaiseAsync` by [@​stakx](https://togithub.com/stakx) in [https://github.com/moq/moq/pull/1313](https://togithub.com/moq/moq/pull/1313) - Add `ThrowsAsync` for non-generic `ValueTask` by [@​johnthcall](https://togithub.com/johnthcall) in [https://github.com/moq/moq/pull/1235](https://togithub.com/moq/moq/pull/1235) - Use PackageLicenseExpression instead of PackageLicenseUrl by [@​wismann](https://togithub.com/wismann) in [https://github.com/moq/moq/pull/1322](https://togithub.com/moq/moq/pull/1322) - Don't throw away generic type arguments in one `mock.Protected().Verify<T>()` method overload by [@​stakx](https://togithub.com/stakx) in [https://github.com/moq/moq/pull/1325](https://togithub.com/moq/moq/pull/1325) - [#​1340](https://togithub.com/moq/moq/issues/1340) updated appveyor.yml with workaround to make builds work again by [@​david-kalbermatten](https://togithub.com/david-kalbermatten) in [https://github.com/moq/moq/pull/1346](https://togithub.com/moq/moq/pull/1346) - Revamp structure, apply oss template, cleanup projects/imports by [@​kzu](https://togithub.com/kzu) in [https://github.com/moq/moq/pull/1358](https://togithub.com/moq/moq/pull/1358) - Add 💜 SponsorLink support by [@​kzu](https://togithub.com/kzu) in [https://github.com/moq/moq/pull/1363](https://togithub.com/moq/moq/pull/1363) - fix website url by [@​tibel](https://togithub.com/tibel) in [https://github.com/moq/moq/pull/1364](https://togithub.com/moq/moq/pull/1364) #### New Contributors - [@​johnthcall](https://togithub.com/johnthcall) made their first contribution in [https://github.com/moq/moq/pull/1235](https://togithub.com/moq/moq/pull/1235) - [@​wismann](https://togithub.com/wismann) made their first contribution in [https://github.com/moq/moq/pull/1322](https://togithub.com/moq/moq/pull/1322) - [@​david-kalbermatten](https://togithub.com/david-kalbermatten) made their first contribution in [https://github.com/moq/moq/pull/1346](https://togithub.com/moq/moq/pull/1346) - [@​dependabot](https://togithub.com/dependabot) made their first contribution in [https://github.com/moq/moq/pull/1360](https://togithub.com/moq/moq/pull/1360) **Full Changelog**: moq/moq.spikes@v4.18.4...v4.20.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Testably/Testably.Architecture.Rules). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4yNy4xIiwidXBkYXRlZEluVmVyIjoiMzYuMjcuMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
vbreuss
referenced
this pull request
in Testably/Testably.Abstractions
Aug 8, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [Moq](https://togithub.com/moq/moq) | nuget | minor | `4.18.4` -> `4.20.0` | --- ### Release Notes <details> <summary>moq/moq (Moq)</summary> ### [`v4.20.0`](https://togithub.com/moq/moq/releases/tag/v4.20.0) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### ✨ Implemented enhancements - Add `setup.Verifiable(Times times, [string failMessage])` method by [@​stakx](https://togithub.com/stakx) in [https://github.com/moq/moq/pull/1319](https://togithub.com/moq/moq/pull/1319) ##### 🔨 Other - Add `Mock<T>.RaiseAsync` by [@​stakx](https://togithub.com/stakx) in [https://github.com/moq/moq/pull/1313](https://togithub.com/moq/moq/pull/1313) - Add `ThrowsAsync` for non-generic `ValueTask` by [@​johnthcall](https://togithub.com/johnthcall) in [https://github.com/moq/moq/pull/1235](https://togithub.com/moq/moq/pull/1235) - Use PackageLicenseExpression instead of PackageLicenseUrl by [@​wismann](https://togithub.com/wismann) in [https://github.com/moq/moq/pull/1322](https://togithub.com/moq/moq/pull/1322) - Don't throw away generic type arguments in one `mock.Protected().Verify<T>()` method overload by [@​stakx](https://togithub.com/stakx) in [https://github.com/moq/moq/pull/1325](https://togithub.com/moq/moq/pull/1325) - [#​1340](https://togithub.com/moq/moq/issues/1340) updated appveyor.yml with workaround to make builds work again by [@​david-kalbermatten](https://togithub.com/david-kalbermatten) in [https://github.com/moq/moq/pull/1346](https://togithub.com/moq/moq/pull/1346) - Revamp structure, apply oss template, cleanup projects/imports by [@​kzu](https://togithub.com/kzu) in [https://github.com/moq/moq/pull/1358](https://togithub.com/moq/moq/pull/1358) - Add 💜 SponsorLink support by [@​kzu](https://togithub.com/kzu) in [https://github.com/moq/moq/pull/1363](https://togithub.com/moq/moq/pull/1363) - fix website url by [@​tibel](https://togithub.com/tibel) in [https://github.com/moq/moq/pull/1364](https://togithub.com/moq/moq/pull/1364) #### New Contributors - [@​johnthcall](https://togithub.com/johnthcall) made their first contribution in [https://github.com/moq/moq/pull/1235](https://togithub.com/moq/moq/pull/1235) - [@​wismann](https://togithub.com/wismann) made their first contribution in [https://github.com/moq/moq/pull/1322](https://togithub.com/moq/moq/pull/1322) - [@​david-kalbermatten](https://togithub.com/david-kalbermatten) made their first contribution in [https://github.com/moq/moq/pull/1346](https://togithub.com/moq/moq/pull/1346) - [@​dependabot](https://togithub.com/dependabot) made their first contribution in [https://github.com/moq/moq/pull/1360](https://togithub.com/moq/moq/pull/1360) **Full Changelog**: moq/moq.spikes@v4.18.4...v4.20.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Testably/Testably.Abstractions). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4yNy4xIiwidXBkYXRlZEluVmVyIjoiMzYuMjcuMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Better late than never. 😁
Usage summary:
1. Specifying a maximum number of allowed calls:
(This is mostly equivalent to the deprecated
setup.AtMostOnce()
andsetup.AtMost(n)
methods, except those didn't mark a setup as verifiable.)2. Using
mock.Verify[All]()
to check whether the setup was called the correct number of times:3. Excluding a setup from
mock.VerifyAll()
using (e.g.)Times.AtMost(int.MaxValue)
:(It would be nicer to have something like
Times.Any
, however that wouldn't make sense in most scenarios and might confuse users into doing strange things, so I chose not to add that to the library for now.)4. Verifying the number of calls in situations where invocation arguments are modified after the invocation (but before verification) happened:
Closes #373, closes #937, closes #1210.