In Pester one can mock an object, and that also works for the PowerCLI .Net objects.
But the New-MockObject cmdlet creates an empty object, and since most properties in PowerCLI .Net objects are read-only, that doesn't offer the possibility to mock such objects with specific values.
It would be handy if there was a new() method for PowerCLI .Net objects that would allow to pre-populate specific properties.
This would allow to write decent Pester tests for PowerCLI scripts.
Could someone please reply to the previous 2 comments?
Is it 'Shipped' or not?
And if it is, where?
Really need this too - any pointers as to where it shipped to?
I see this has been set to shipped, does that mean that this is actually going to be in the next release? Or is this declaring that the dsc module mocks are good enough?
Pester is the main Test Engine for Powershell, Powercli should get the attention it deserve regarding this feature.I just want to say a million thanks to Luc D for his Pester Blog Article http://www.lucd.info/2019/02/01/dscr-and-pester-testing/