I have a problem with VB9 and Moq.
I need to call a confirmation on Sub. For instance:
logger.Verify(Function(x) x.Log, Times.AtLeastOnce)
And my registrar looks like this:
Public Interface ILogger
Sub Log()
End Interface
But with VB, this is not possible, because the Log method is Sub and therefore does not give a value.
I do not want the method to be a function.
What is the cleanest way around this limitation and is there a way to wrap Sub as a function, as shown below?
logger.Verify(Function(x) ToFunc(AddressOf x.Log), Times.AtLeastOnce)
I tried this, but I get:
Lambda parameter out of scope
source
share