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

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -