Last active
May 11, 2020 09:03
-
-
Save JohnRoos/0549ff530d137ea57fbf1169e2b5f4ad 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
#region LabModule.psd1 | |
@{ | |
RootModule = 'LabModule.psm1' | |
ModuleVersion = '1.0' | |
GUID = 'd00578f5-fb6b-4c47-83fb-ed1c8d9a1ec2' | |
FunctionsToExport = 'Get-PublicStuff' | |
} | |
#endregion | |
#region LabModule.psm1 | |
# public function | |
function Get-PublicStuff { | |
Get-PrivateStuff | |
} | |
# private function | |
function Get-PrivateStuff { | |
'This is very private' | |
} | |
#endregion | |
#region LabModule.tests.ps1 | |
Import-Module .\LabModule.psd1 -Force | |
Describe "LabModule" { | |
Context "Private functions" { | |
It "Should invoke private function once" { | |
Mock Get-PrivateStuff { 'mocked' } -ModuleName 'LabModule' | |
Get-PublicStuff | |
Should -Invoke 'Get-PrivateStuff' -Exactly 1 -ModuleName 'LabModule' | |
} | |
} | |
} | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment