pester/Pester — pull request #140 by amercier (2014-06-17 16:12:02+00:00)
Title: Mocking public module functions

Hi,

I'm having issues **mocking public module functions**.

In the example below, I'm creating a module called `TestModule` containing a public function called `PublicFunction`. I also declare a function called `StandaloneFunction`, that uses the `TestModule`'s `PublicFunction`:

New-Module -Name TestModule {
function PublicFunction { 'I am the public function' }
Export-ModuleMember -Function PublicFunction
} | Import-Module -Force

function StandaloneFunction {
PublicFunction
}

Then, when I try to mock the `PublicFunction` function:

It 'Should call the mocked function' {
Mock PublicFunction { 'I am the mock test' } -moduleName TestModule
StandaloneFunction | Should Be 'I am the mock test'
}

The test above fails.

1. Did I do something wrong?
2. Is it a Pester bug, or is it something which is impossible to achieve with PowerShell?

**I have included unit tests with this PR to show the problem.**

Please note that I'm a PowerShell beginner and I don't have the necessary skills to submit a patch yet.