Skip to content

Commit

Permalink
add help documentation regarding module limitations of mocking
Browse files Browse the repository at this point in the history
  • Loading branch information
mwrock committed Oct 29, 2012
1 parent 6c4b25e commit 3235727
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Functions/Mock.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ used to check if all Verifiable mocks were actually called. If any
verifiable mock is not called, Assert-VerifiableMocks will throw an
exception and indicate all mocks not called.
The SUT (code being tested) that calls the actual commands that you have
mocked must not be executing from inside a module. Otherwise, the mocked
commands will not be invoked and the real commands will run. The SUT must
be in the same Script scope as the test. So it must be either dot sourced,
in the same file, or in a script file.
.PARAMETER CommandName
The name of the command to be mocked.
Expand Down
7 changes: 7 additions & 0 deletions en-US/about_Mocking.help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ EXAMPLE
}
}

LIMITATIONS
The SUT (code being tested) that calls the actual commands that you have
mocked must not be executing from inside a module. Otherwise, the mocked
commands will not be invoked and the real commands will run. The SUT must
be in the same Script scope as the test. So it must be either dot sourced,
in the same file, or in a script file.

SEE ALSO
Mock
Assert-VerifiableMocks
Expand Down

0 comments on commit 3235727

Please sign in to comment.