I have a string array, $ServerNames, with two elements: 'ServerName1' and 'ServerName2'. I then have a corresponding MOCK:
Mock 'Get-ADComputer' { $Server1; write-host 'test'}
Mock 'Get-ADComputer' { $foo } -ParameterFilter { $Identity -eq "$(${server_names}[0])" }
The mock without the filter gets called. The one that has the filter doesn't. If I remove the filter less mock, the Get-ADComputer commandlet is actually called. Why won't the filtered mock kick in?
F.Y.I., I tried $server_names[0] instead of interpolating them in a string.