tests/Datacenter.Tests.ps1
param ( $PrevInventory, $CurInventory, $Test, $IncludeAdvSettings, $Filter ) foreach ($PrevDc in $PrevInventory.Datacenter) { $CurDc = $CurInventory.Datacenter.Where({$_.Id -eq $PrevDc.Id}) Describe "Datacenter: $($PrevDc.Name)" { if ($Test -match "All|Datacenter") { It "<Name> should be <Value>" -TestCases $PrevDc.GetArrayToCompare() { param ($Name, $Value) $CurDc.$($Name) | Should -Be $Value } } # Test all clusters and their hosts in the DC inventory $PrevClusters = $PrevInventory.ClusterComputeResource.Where({$_.Id -in $PrevDc.Children}) $CurClusters = $CurInventory.ClusterComputeResource.Where({$_.Id -in $PrevDc.Children}) $Params = @{ PrevClusters = $PrevClusters CurClusters = $CurClusters Test = $Test IncludeAdvSettings = $IncludeAdvSettings Filter = $Filter } & "$PSScriptRoot\ClusterComputeResource.Tests.ps1" @Params if ($Test -match "All|HostSystem") { # Test standalone hosts in the DC inventory $PrevVMHosts = $PrevInventory.HostSystem.Where({ ($_.Id -in $PrevDc.Children) -and -not ($_.Parent.StartsWith("ClusterComputeResource"))}) $CurVMHosts = $CurInventory.HostSystem.Where({ ($_.Id -in $PrevDc.Children) -and -not ($_.Parent.StartsWith("ClusterComputeResource"))}) $Params = @{ PrevVMHosts = $PrevVMHosts CurVMHosts = $CurVMHosts Test = $Test IncludeAdvSettings = $IncludeAdvSettings Filter = $Filter } & "$PSScriptRoot\HostSystem.Tests.ps1" @Params } } } |