-
-
Save ferventcoder/1114813 to your computer and use it in GitHub Desktop.
mock.Verify(m => m.Subscribe<Message>(someclass.SomeMethod, null, x => true), Times.AtLeastOnce()); |
mock.Verify(sm => m.Subscribe<Message>(someclass.SomeMethod, null, It.IsAny<Func<ModelAlterationMessage, bool>>()), Times.AtLeastOnce());
Cuts the error and fixes my issue...however I would like to not have to pass the some method from the class in there.... It.IsAny<Action> doesn't quite work...
Thanks for the help Jason!
don't know if this is possible with moq (haven't used it in a while due to it's moq.Object tax) but with Rhino you can register a callback to fire when the method is called (if set as a setup/expectation, anyway) and in that callback have access to the method invocation that was matched (m.Subscribe() in this case) including it's args. If moq has a similar idiom then perhaps you could trap the matching method invocation and peek at the type of someclass.SomeMethod as seen by moq. It may not be an Action... even if that's the arg type and how the type of SomeMethod looks to you.
I want to call It.IsAny<Method> instead of passing a particular method.