VMware PowerCLI

The Best User Interface for your VMware Datacenter!

Pester support : add an option to create a "mock" PowerCLI .Net object with values assigned to properties

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.

  • Luc Dekens
  • Jan 24 2018
  • Attach files