Wraped all the tests inModuleScope for invoke-pester invocation.
Moved function name into module scope.
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
#Requires -Modules Pester, VMware.VMC
|
#Requires -Modules Pester, VMware.VMC
|
||||||
$functionName = $MyInvocation.MyCommand.Name.TrimEnd(".Tests.ps1")
|
|
||||||
Describe "$functionName" -Tag 'Unit' {
|
inModuleScope VMware.VMC {
|
||||||
|
$functionName = "Connect-VMCVIServer"
|
||||||
|
Describe "$functionName" -Tag 'Unit' {
|
||||||
. "$PSScriptRoot/Shared.ps1"
|
. "$PSScriptRoot/Shared.ps1"
|
||||||
|
|
||||||
$Org = 'MyOrg'
|
$Org = 'MyOrg'
|
||||||
@@ -56,4 +58,5 @@ Describe "$functionName" -Tag 'Unit' {
|
|||||||
-and $Password -eq $Mockedcreds.password }
|
-and $Password -eq $Mockedcreds.password }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
#Requires -Modules Pester, VMware.VMC, VMware.VimAutomation.Vmc
|
#Requires -Modules Pester, VMware.VMC, VMware.VimAutomation.Vmc
|
||||||
$functionName = $MyInvocation.MyCommand.Name.TrimEnd(".Tests.ps1")
|
|
||||||
|
|
||||||
Describe "$functionName" -Tag 'Unit' {
|
|
||||||
|
inModuleScope VMware.VMC {
|
||||||
|
$functionName = "Get-VMCCommand"
|
||||||
|
Describe "$functionName" -Tag 'Unit' {
|
||||||
Mock Get-Command {
|
Mock Get-Command {
|
||||||
"Mocked Command Response"
|
"Mocked Command Response"
|
||||||
}
|
}
|
||||||
@@ -17,4 +19,5 @@ Describe "$functionName" -Tag 'Unit' {
|
|||||||
Assert-MockCalled -CommandName Get-command -Times 1 -Scope It -ParameterFilter { $Module -eq 'VMware.VMC' }
|
Assert-MockCalled -CommandName Get-command -Times 1 -Scope It -ParameterFilter { $Module -eq 'VMware.VMC' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
#Requires -Modules Pester, VMware.VMC
|
#Requires -Modules Pester, VMware.VMC
|
||||||
$functionName = $MyInvocation.MyCommand.Name.TrimEnd(".Tests.ps1")
|
|
||||||
Import-Module -Name VMware.VimAutomation.Cis.Core
|
Import-Module -Name VMware.VimAutomation.Cis.Core
|
||||||
|
|
||||||
Describe "$functionName" -Tag 'Unit' {
|
inModuleScope VMware.VMC {
|
||||||
|
$functionName = "Get-VMCOrg"
|
||||||
|
Describe "$functionName" -Tag 'Unit' {
|
||||||
. "$PSScriptRoot/Shared.ps1"
|
. "$PSScriptRoot/Shared.ps1"
|
||||||
|
|
||||||
$global:DefaultVMCServers = $true
|
$global:DefaultVMCServers = $true
|
||||||
@@ -70,4 +71,5 @@ Describe "$functionName" -Tag 'Unit' {
|
|||||||
$(Get-VMCOrg -name $OrgName)[1].id | Should -be $id
|
$(Get-VMCOrg -name $OrgName)[1].id | Should -be $id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
#Requires -Modules Pester, VMware.VMC
|
#Requires -Modules Pester, VMware.VMC
|
||||||
$functionName = $MyInvocation.MyCommand.Name.TrimEnd(".Tests.ps1")
|
|
||||||
Import-Module -Name VMware.VimAutomation.Cis.Core
|
Import-Module -Name VMware.VimAutomation.Cis.Core
|
||||||
|
|
||||||
Describe "$functionName" -Tag 'Unit' {
|
inModuleScope VMware.VMC {
|
||||||
|
$functionName ="Get-VmcSddc"
|
||||||
|
Describe "$functionName" -Tag 'Unit' {
|
||||||
. "$PSScriptRoot/Shared.ps1"
|
. "$PSScriptRoot/Shared.ps1"
|
||||||
|
|
||||||
$global:DefaultVMCServers = $true
|
$global:DefaultVMCServers = $true
|
||||||
@@ -77,4 +78,5 @@ Describe "$functionName" -Tag 'Unit' {
|
|||||||
$(Get-VMCSDDC -Org $OrgId -name $name).name | Should -be $name
|
$(Get-VMCSDDC -Org $OrgId -name $name).name | Should -be $name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
#Requires -Modules Pester, VMware.VMC
|
#Requires -Modules Pester, VMware.VMC
|
||||||
$functionName = $MyInvocation.MyCommand.Name.TrimEnd(".Tests.ps1")
|
|
||||||
Import-Module -Name VMware.VimAutomation.Cis.Core
|
Import-Module -Name VMware.VimAutomation.Cis.Core
|
||||||
|
|
||||||
Describe "$functionName" -Tag 'Unit' {
|
inModuleScope VMware.VMC {
|
||||||
|
$functionName = "Get-VMCTask"
|
||||||
|
Describe "$functionName" -Tag 'Unit' {
|
||||||
. "$PSScriptRoot/Shared.ps1"
|
. "$PSScriptRoot/Shared.ps1"
|
||||||
|
|
||||||
$global:DefaultVMCServers = $true
|
$global:DefaultVMCServers = $true
|
||||||
@@ -75,4 +76,5 @@ Describe "$functionName" -Tag 'Unit' {
|
|||||||
$(Get-VMCTask -Org $OrgId)[1].name | Should -be $Notname
|
$(Get-VMCTask -Org $OrgId)[1].name | Should -be $Notname
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user