You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When doing setup of mocks and afterwards verifying you do a lot of repeated code, test code can become somewhat unnecessary bloated with text and it is harder to read.
When setting up a mock you describe your expectations to the setup.
Example:
I propose that what if the Verify could be done much simpler so i do not have to adjust if i change my parameters for the setup and keeping test code clean and concise.
Often they are exactly the same.
Since i do a lot of Mocks and usually you need to verify that the setup matches the verification, merging this into a convenience method that will allow us to:
Limit the amount of code to write to do a mock verification
Keep the test code lean
Keep the test code lean and also clear.
The text was updated successfully, but these errors were encountered:
Unfortunately, we cannot have Setup, ReturnsAsync, and Verifiable return the setup directly due to how the fluent API has been implemented; changing this might be a major breaking change, so for now you'll have to resort to fetching the setup using mock.Setups.Last() or similar.
(Notice: There's likely a small binary breaking change coming up sometime in the future that will affect the last line of code. This is in order to resolve #1093. The optional recursive parameter will be removed from that Verify method. The above source code would still compile even after that change, but binaries will have to be rebuilt.)
@tlogik, I am going to close this issue since it appears that what you requested can already be done. If I misunderstood something, let me know and we can reopen this issue.
Problem statement.
When doing setup of mocks and afterwards verifying you do a lot of repeated code, test code can become somewhat unnecessary bloated with text and it is harder to read.
When setting up a mock you describe your expectations to the setup.
Example:
I propose that what if the Verify could be done much simpler so i do not have to adjust if i change my parameters for the setup and keeping test code clean and concise.
Often they are exactly the same.
Example.
Since i do a lot of Mocks and usually you need to verify that the setup matches the verification, merging this into a convenience method that will allow us to:
The text was updated successfully, but these errors were encountered: