While there are many examples of using Pester to Assert a Mock, I am unable to find good (or any) examples on how to use Pester to get parameters made upon a Mock; this is useful to get a meaningful error message instead of a generic message of so-so usefulness:
Expected Invoke-XYZ to be called at least 1 times but was called 0 times
Thanks, and obviously; might as well be a "didn't work" SO question.
In RhinoMocks + NUnit (C#), for example, one might use code similar to the following to assert that the mock was called and the arguments match some criteria. If the call was made and the arguments do not match, then a useful assertion message is displayed:
var actual = mock.GetArgumentsForCallsMadeOn(m => ..);
Assert.That(actual, Is.EqualTo(expected));
How can the same (or similar) be done in Pester?
The goal is to make failing mock assertions result in useful error messages as to what particular parameter failed the expectations, and with what value(s).
PowerShell is 5.1 and Pester is 4.8.1.