I\'ve got an interface which declares
Task DoSomethingAsync();
I\'m using MoqFramework for my tests:
[TestMethod()]
public
Similar Issue
I have an interface that looked roughly like:
Task DoSomething(int arg);
Symptoms
My unit test failed when my service under test awaited the call to DoSomething.
Fix
Unlike the accepted answer, you are unable to call .ReturnsAsync() on your Setup() of this method in this scenario, because the method returns the non-generic Task, rather than Task.
However, you are still able to use .Returns(Task.FromResult(default(object))) on the setup, allowing the test to pass.