Files
PowerCLI-Example-Scripts/Pester/Functions/Get-VMCCommand.tests.ps1
Conor Tolan 5c833d4ce5 Wraped all the tests inModuleScope for invoke-pester invocation.
Moved function name into module scope.
2019-02-23 18:56:44 +00:00

23 lines
830 B
PowerShell

#Requires -Modules Pester, VMware.VMC, VMware.VimAutomation.Vmc
inModuleScope VMware.VMC {
$functionName = "Get-VMCCommand"
Describe "$functionName" -Tag 'Unit' {
Mock Get-Command {
"Mocked Command Response"
}
Context "Behavior testing" {
It "should call get-command on VMware.VimAutomation.Vmc" {
{ Get-VMCCommand } | Should Not Throw
Assert-MockCalled -CommandName Get-command -Times 1 -Scope It -ParameterFilter { $Module -eq 'VMware.VimAutomation.Vmc' }
}
It "should call get-command on VMware.Vmc" {
{ Get-VMCCommand } | Should Not Throw
Assert-MockCalled -CommandName Get-command -Times 1 -Scope It -ParameterFilter { $Module -eq 'VMware.VMC' }
}
}
}
}