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
Post a Comment