I'm trying to unit test an Azure Function which has a dependency with MessageReceiver class. The class definition looks like:
public class MessageReceiver : ClientEntity, IMessageReceiver, IReceiverClient, IClientEntity
And the methods that I need to moq belong to the interface IMessageReceiver
I tried Mocking the class MessageReceiver, and Setup the method CompleteAsync but I got the error:
Non-overridable members (here: MessageReceiver.CompleteAsync) may not be used in setup / verification expressions.
Which afaik means that methods that are not virtual, abstract, or override can not be overriden/moq. I tried manually creating a child class and declaring a method CompleteAsync with the new keywork in the definition,
public new Task CompleteAsync(string lockToken)
in this case the code throws an error at the point where the CompleteAsync method is called:
Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
But I don't think it can work, since I tried pressing F11 to enter the method, and my method was not called... Any ideas or sugestions?