Created
June 15, 2016 14:52
-
-
Save gerane/19f1816480a0b71a1c7d7db8225cedd5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Is there a reason why one might use Example 1 over Example 2 if only using a single command? | |
| ## Example 1 | |
| New-Module -Name SomeModule -Function "SomeFunction" -ScriptBlock { Function SomeFunction { Write-Host "Invoking SomeFunction with $params"} } | Import-Module | |
| ## Example 2 | |
| Function SomeFunction { Write-Host "Invoking SomeFunction with $params"} | |
| ## Example Usage | |
| Describe "Invoke-Something" { | |
| It 'Mocks a Dependency' { | |
| Mock SomeFunction {} | |
| $Results = Invoke-Something -param1 $param1 -Param2 $param2 -Verbose -Force | |
| $Results | Should be 'Something' | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment