DEV Community

Discussion on: Unit testing in PowerShell, introduction to Pester

omiossec profile image
Olivier Miossec Author

I plan to write a post about mocking in Pester

You should try to do somehitng like that

Mock Get-PnPList -MockWith {
"Title" = "testList"
} -ParameterFilter { $Identity -eq "testList" }

xero399 profile image

Hi, thanks for the answer. Tried like you said but doesn't work. Finally I have found that the problem was the -ParameterFilter. Doing $Identity.toString() -eq "testList" it works perfectly. That .toString() makes the difference!