tests/HostSystem.Tests.ps1
param ( [VexaHostSystem[]] $PrevVMHosts, [VexaHostSystem[]] $CurVMHosts, $Test, $IncludeAdvSettings, [hashtable] $Filter ) if ($Filter.HostSystem) { $PrevVMHosts = $PrevVMHosts.Where({$_.Name -in $Filter.HostSystem}) } foreach ($PrevVMHost in $PrevVMHosts | Sort-Object "Name") { $CurVMHost = $CurVMHosts.Where({$_.Id -eq $PrevVMHost.Id}) Describe "VMHost: $($PrevVMHost.Name)" { It "<Name> should be <Value>" -TestCases $PrevVMHost.GetArrayToCompare() { param ($Name, $Value) $CurVMHost.$($Name) | Should -Be $Value } Describe "Host Services" { $SrvTestCases = $PrevVMHosts.ServiceStatus.GetArrayToCompare() It "<Name> running status should be <value>" -TestCases $SrvTestCases { param ($Name, $Value) $CurVMHost.ServiceStatus.$($Name) | Should -Be $Value } } Describe "Network Adapters" { foreach ($Pnic in $PrevVMHost.NetworkAdapter) { Describe "$($Pnic.Device)" { $CurPnic = $CurVMHost.NetworkAdapter.Where({$_.Device -eq $Pnic.Device}) It "<Name> should be <value>" -TestCases $Pnic.GetArrayToCompare() { param ($Name, $Value) $CurPnic.$($Name) | Should -Be $Value } } } } Describe "Storage Adapters" { foreach ($Adapter in $PrevVMHost.StorageAdapter) { Describe "$($Adapter.Device)" { $CurAdapter = $CurVMHost.StorageAdapter.Where({$_.Device -eq $Adapter.Device}) It "<Name> should be <value>" -TestCases $Adapter.GetArrayToCompare() { param ($Name, $Value) $CurAdapter.$($Name) | Should -Be $Value } } } } if ($IncludeAdvSettings) { Describe "Host Advanced Settings" { It "<Name> should be <Value>" -TestCases $PrevVMHost.AdvancedSettings.GetArrayToCompare() { param ($Name, $Value) $CurVMHost.AdvancedSettings.$($Name) | Should -Be $Value } } } } } |