Let's say I have a method that looks something like this:
$arguments = @{File=$true}
if (SomeCondition)
$arguments.Recurse = $true
$arguments.Path = "SomeFile"
return Get-ChildItem @arguments
I would now like to test that Get-ChildItem is called with the correct arguments. So I mock it and:
Assert-MockCalled Get-ChildItem -Exactly 1 {$Recurse -eq $true}
That will blow up saying that 'A parameter cannot be found that matches parameter name 'File'.'
I think it has to do with me using splatting but I don't know...
I belive that the error lies with me trying to call Get-ChildItem using splatting ( @arguments ) when Get-ChildItem is mocked.Splatting tries to match the parameters with key=value as far as I understand and since -File is missing...well
The strange thing is that line 169 in Mock.ps1 ...this one:
$params
= [Management.Automation.ProxyCommand]::GetParamBlock($metadata)
doesn't include the -File parameter of Get-ChildItem. To me that is strange...
Any ideas...?
Weird that intellisense was showing a “File” param. That would be confusing (and wrong). Glad you figured it out.
...For more options, visit <a onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;" href="https://groups.google.com/groups/opt_out" target="_bl