|
Is there a recommended way of creating a Pester mock that has a different result for sequential calls? I currently have a solution that's a bit inelegant that uses a variable to track call counts and returns different results based on that variable. By inelegant, I mean that there's too much code here to manage the state of the mock. It'd be great if I provide an array of script blocks and the Mock had internal state to track which sequential result is used. |
Answered by
fflaten
Jun 8, 2023
Replies: 1 comment 4 replies
|
Hi. Great question! The behavior is likely too specific to become an official API. If you write a lot of these mocks, I'd try to write a helper function to generate at least the mock scriptblock and counter-variable using the syntax you want. |
4 replies
Answer selected by
nohwnd
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi. Great question! The behavior is likely too specific to become an official API.
If you write a lot of these mocks, I'd try to write a helper function to generate at least the mock scriptblock and counter-variable using the syntax you want.