Pester Testing .Net with PowerShell Classes

One problem I’ve come across with Pester is it has no good way to Mock .Net objects. This hasn’t caused me too much trouble as I can just wrap .Net methods in functions and mock the function, but I had a case come up where I needed to specify the .Net type in my function parameter, so I couldn’t just wrap this in a function:

As you can see, I’m specifying the type and it is a required parameter, … Continue reading