Verify method with Delegate parameter in Moq
Posted
by Hans Løken
on Stack Overflow
See other posts from Stack Overflow
or by Hans Løken
Published on 2010-04-12T11:40:51Z
Indexed on
2010/04/12
11:43 UTC
Read the original article
Hit count: 418
I have a case where I want to verify that a method that takes a Delegate parameter is called. I don't care about the particular Delegate parameter supplied I just want to make sure that the method is in fact called. The method looks like this:
public interface IInvokerProxy{
void Invoke(Delegate method);
...
}
I would like to do something like this:
invokerProxyMock.Verify( proxy => proxy.Invoke( It.IsAny<Delegate>));
Currently it gives me an error Argument '1': cannot convert from 'method group' to 'System.Delegate'. Does anyone know if this is possible?
© Stack Overflow or respective owner