Mock.Get is throwing exception 'Invalid verify on a non-virtual (overridable in VB) member:


(AK) #1

Hi,

I am using Mocking in my Test project. When I change Resolve<> from IBus to IMessageHandlerContext it it throwing the exception. Mock.Get is throwing exception ‘Invalid verify on a non-virtual (overridable in VB) member: a => a.Send(It.IsAny())’. I tired multiple ways, As time concern I cannot move from this existing testing to another. Could you please help me on this

Mock.Get(container.Resolve())
.Verify(a => a.Send(It.IsAny()), Times.Exactly(0));


(Szymon Pobiega) #2

Hi

I am not familiar with Mocking but the reason might be that the Send on the message context returns a Task while the Send on the bus did not. Not sure if Mocking has a different API for configuring returning or non-returning methods and how does it handle async.

Szymon