pester/Pester — pull request #203 by dlwyatt (2014-08-31 21:31:46+00:00)
Title: Mocking commands that have Dynamic Parameters

This update allows for mocking cmdlets or advanced functions that have dynamic parameters.

There is technically a breaking change from Pester v3.0 in here. In Pester v3.0, when a mock is defined with the -ModuleName parameter, the MockWith block would be executed within that module's scope. This has been updated to execute the MockWith block out in the same scope as the test script, since the other scenario is now covered by InModuleScope anyway.

This allows the MockWith block to access variables that were defined out in the test script in all cases, and also cleared up some problems around the new Set-DynamicParameterVariables function while I was working on this branch.