tests/VIServer.Tests.ps1

param (
    $PrevInventory,
    $CurInventory,
    $Test,
    $IncludeAdvSettings,
    $Filter
)

$PrevVIServer = $PrevInventory.VIServer
$CurVIServer = $CurInventory.VIServer
Describe "vCenter Server: $($PrevVIServer.Name)" {
    if ($Test -match "All|VIServer") {
        It "<Name> should be <Value>" -TestCases $PrevVIServer.GetArrayToCompare() {
            param ($Name, $Value)
            $CurVIServer.$($Name) | Should -Be $Value
        }

        if ($IncludeAdvSettings) {
            Describe "vCenter Advanced Settings" {
                It "<Name> should be <Value>" -TestCases $PrevVIServer.AdvancedSettings.GetArrayToCompare() {
                    param ($Name, $Value)
                    $CurVIServer.AdvancedSettings.$($Name) | Should -Be $Value
                }
            }
        }
    }

    if (-not (($Test.Count -eq 1) -and ($Test -match "VIServer"))) {
        $Params = @{
            PrevInventory = $PrevInventory
            CurInventory = $CurInventory
            Test = $Test
            IncludeAdvSettings = $IncludeAdvSettings
            Filter = $Filter
        }
        & "$PSScriptRoot\Datacenter.Tests.ps1" @Params
    }
}