Is it possible to use Pester tags in logic? For example, I have the following Describe block:
Describe "Connected to vCenter instance 1" -Tag @("vmware-vdi","vmware-all") {
Connect-ViServer MyVcenter1
$arrConnectedViServers=$global:DefaultVIServers
$bolConnected=$false
foreach ($ConnectedViServerin$arrConnectedViServers) {
if ($ConnectedViServer.Name -eq$VdiVcenter) {
$bolConnected=$true
}
}
It "We should be connected to the vCenter instance 1" {
$bolConnected|Should Be $true
}
}
Since I have two separate instances of VMware vCenter, I have to have two separate Describe blocks (using different tag arrays). What I would like to be able to do is use a Switch statement based on the tags. That would allow me to connect to either one or both vCenter instances in one Describe block.