Wraped all the tests inModuleScope for invoke-pester invocation.

Moved function name into module scope.
This commit is contained in:
Conor Tolan
2019-02-23 18:56:44 +00:00
parent b90c83ac56
commit 5c833d4ce5
5 changed files with 264 additions and 252 deletions

View File

@@ -1,5 +1,7 @@
#Requires -Modules Pester, VMware.VMC
$functionName = $MyInvocation.MyCommand.Name.TrimEnd(".Tests.ps1")
inModuleScope VMware.VMC {
$functionName = "Connect-VMCVIServer"
Describe "$functionName" -Tag 'Unit' {
. "$PSScriptRoot/Shared.ps1"
@@ -57,3 +59,4 @@ Describe "$functionName" -Tag 'Unit' {
}
}
}
}

View File

@@ -1,6 +1,8 @@
#Requires -Modules Pester, VMware.VMC, VMware.VimAutomation.Vmc
$functionName = $MyInvocation.MyCommand.Name.TrimEnd(".Tests.ps1")
inModuleScope VMware.VMC {
$functionName = "Get-VMCCommand"
Describe "$functionName" -Tag 'Unit' {
Mock Get-Command {
"Mocked Command Response"
@@ -18,3 +20,4 @@ Describe "$functionName" -Tag 'Unit' {
}
}
}
}

View File

@@ -1,7 +1,8 @@
#Requires -Modules Pester, VMware.VMC
$functionName = $MyInvocation.MyCommand.Name.TrimEnd(".Tests.ps1")
Import-Module -Name VMware.VimAutomation.Cis.Core
inModuleScope VMware.VMC {
$functionName = "Get-VMCOrg"
Describe "$functionName" -Tag 'Unit' {
. "$PSScriptRoot/Shared.ps1"
@@ -71,3 +72,4 @@ Describe "$functionName" -Tag 'Unit' {
}
}
}
}

View File

@@ -1,7 +1,8 @@
#Requires -Modules Pester, VMware.VMC
$functionName = $MyInvocation.MyCommand.Name.TrimEnd(".Tests.ps1")
Import-Module -Name VMware.VimAutomation.Cis.Core
inModuleScope VMware.VMC {
$functionName ="Get-VmcSddc"
Describe "$functionName" -Tag 'Unit' {
. "$PSScriptRoot/Shared.ps1"
@@ -78,3 +79,4 @@ Describe "$functionName" -Tag 'Unit' {
}
}
}
}

View File

@@ -1,7 +1,8 @@
#Requires -Modules Pester, VMware.VMC
$functionName = $MyInvocation.MyCommand.Name.TrimEnd(".Tests.ps1")
Import-Module -Name VMware.VimAutomation.Cis.Core
inModuleScope VMware.VMC {
$functionName = "Get-VMCTask"
Describe "$functionName" -Tag 'Unit' {
. "$PSScriptRoot/Shared.ps1"
@@ -76,3 +77,4 @@ Describe "$functionName" -Tag 'Unit' {
}
}
}
}