$VSwitch = Get-VMHost $HostName | get-virtualswitch -name vswitch0 -Standard
and
$VSwitch = Get-VMHost $HostName
$VSwitch = get-virtualswitch -name vswitch0 -Standard $VSwitch
Are these two functions going to be giving the same output ?
I am using Pester tests but one of them gives me an error while the other does not. I am assuming something is wrong with how I am mocking them
$vmhost = New-MockObject -T 'VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl' -Properties @{
Name = "esx-1.bluedog.microsoft.com"
Datacenter = "Datacenter"
}
$switch_params = @{
Name = "Vswitch0"
Mtu = 5000
}
$switch1 = New-MockObject -T 'VMware.VimAutomation.ViCore.Impl.V1.Host.Networking.VirtualSwitchImpl' -Properties $switch_params
Mock Get-VMHost { return $vmhost } -ModuleName $module
Mock get-virtualswitch { return $switch1 } -ModuleName $module
I am using Pester tests but one of them gives me an error while the other does not. I am assuming something is wrong with how I am mocking them, I was assuming to get same output is both of them and to be able to print VSwitch0 somehow.