c# - Verifying a delegate was called with Moq -


i got class gets argument delegate. class invokes delegate, , want unit test moq. how verify method called ?

example class :

public delegate void foo(int number);  public class {    int a=5;     (foo myfoo)    {       foo(a);    } } 

and want check foo called. thank you.

what using anonymous function? can act inline mock here, don't need mocking framework.

bool isdelegatecalled = false; var = new a(a => { isdelegatecalled = true});  //do assert.true(isdelegatecalled); 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -