mono - Moq: Verifying a method was called with a particular delegate produces "method argument length mismatch" -
i've got class a
calls method on interface b
, passing 1 of own methods sort of continuation b
supposed call when has result. code seems work fine in practice, can't figure out how test moq -- when try obvious thing, produces system.argumentexception : method argument length mismatch
. thought @ first might code, fails same way following toy case:
public class { readonly b myb; public (b b) { myb = b; } public void handlec (c c) { // } public void dofindc () { myb.findc (handlec); } } public interface b { // finds c , passes handlec void findc (action<c> handlec); } public interface c { } [testfixture()] public class atest { [test()] public void testdofindc () { mock<b> bmock = new mock<b> (); a = new a(bmock.object); a.dofindc(); bmock.verify(b => b.findc(a.handlec)); } }
i'm guessing there's behind-the-scenes magic delegates don't understand yet, being relatively new c#, what's right way test this?
update: reference, i'm using mono 2.6.7 on macos 10.6.5 , targeting .net 3.5.
updated again: best guess mono bug; i've filed https://bugzilla.novell.com/show_bug.cgi?id=656918.
Comments
Post a Comment