-
Hello Together, $test = New-MockObject -Type 'Net.Sockets.TcpClient' -Methods @{
Connect = { param($Server, $Port)"connect" };
Close = { param($Server, $Port)"close" }
} Error Message: InvalidOperation: C:\Program Files\PowerShell\Modules\Pester\5.3.0\Pester.psm1:12499:13
Line |
12499 | $mockState[$historyName] = @{
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unable to index into an object of type "System.Management.Automation.PSNoteProperty". Works fine with single method: $test = New-MockObject -Type 'Net.Sockets.TcpClient' -Methods @{
Connect = { param($Server, $Port)"connect" }
} Also fine with multiple properties: $test = New-MockObject -Type 'Net.Sockets.TcpClient' -Properties @{
Connect = "connect" ;
Close = "close"
} Using Pester Version 5.3.0 from psgallery on Windows Powershell Core 7.1.4 Thanks already for feedback |
Beta Was this translation helpful? Give feedback.
Answered by
nohwnd
Aug 31, 2021
Replies: 1 comment 2 replies
-
Not a stupid question. It was a bug #2068 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
nohwnd
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not a stupid question. It was a bug #2068