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
I may be unique in this notion, but I sometimes find myself needing mock callbacks. I generally use these in tests in place of actual callbacks I'd pass to methods. I do two things with these:
Have code under test invoke them, where I may provide a function body that performs assertions against the callback parameters.
Assert that they were invoked, so I know that any desired interaction and/or parameter assertions actually happened.
The latter is the main annoying point, as I've tended to have to keep a separate flag that the function body modifies to indicate that it's been called.
Interoperability with Phake's API to verify calls (e.g. any, none, a specific quantity, etc.) and perform parameter assertions against callbacks, as we're currently able to do with mock object methods, would be a lot nicer than code I've tended to write to accomplish the same thing.
The text was updated successfully, but these errors were encountered:
I may be unique in this notion, but I sometimes find myself needing mock
callbacks. I generally use these in tests in place of actual callbacks I'd
pass to methods. I do two things with these:
Have code under test invoke them, where I may provide a function
body that performs assertions against the callback parameters.
Assert that they were invoked, so I know that any desired
interaction and/or parameter assertions actually happened.
The latter is the main annoying point, as I've tended to have to keep a
separate flag that the function body modifies to indicate that it's been
called.
Interoperability with Phake's API to verify calls (e.g. any, none, a
specific quantity, etc.) and perform parameter assertions would be a lot
nicer than code I've tended to write to accomplish the same thing.
—
Reply to this email directly or view it on GitHub #200.
I may be unique in this notion, but I sometimes find myself needing mock callbacks. I generally use these in tests in place of actual callbacks I'd pass to methods. I do two things with these:
The latter is the main annoying point, as I've tended to have to keep a separate flag that the function body modifies to indicate that it's been called.
Interoperability with Phake's API to verify calls (e.g. any, none, a specific quantity, etc.) and perform parameter assertions against callbacks, as we're currently able to do with mock object methods, would be a lot nicer than code I've tended to write to accomplish the same thing.
The text was updated successfully, but these errors were encountered: