0

I have a function with the following signature

I'm trying to mock this and get a value back

Sub CreateEntry(ByVal description As String, response As Action(Of AsyncResponse(Of Response)))

the second parameter is a callback and I'm trying to get it back by:

serviceProxy.Setup(Sub(sp) sp.CreateEntry(It.IsAny(Of String),It.Isany(Of AsyncResponse(Of Response))))

This gives me the following error:
Value of type 'AsyncResponse(Of Response)' cannot be converted to 'System.Action(Of AsyncResponse(Of Response))'

any ideas?

Thanks

4

1 回答 1

0

问题是您试图在设置中匹配AsyncResponse(of Response)而不是Action(of AsyncResponse(of Response))

尝试

serviceProxy.Setup(Sub(sp) sp.CreateEntry(It.IsAny(Of String),It.IsAny(Of Action(Of AsyncResponse(Of Response)))))
于 2012-10-08T12:38:26.127 回答