I use Moq. I have mocked a class which has method that looks like following:
public async Task DoSomething()
{
// do something...
}
I setup it like below:
SomeMock.Setup(x => x.DoSomething())
.Callback(() => ... ))
.Returns(Task.FromResult(default(int)));
I don't like last line: .Returns(Task.FromResult(default(int)))
. Is there a way to setup async return in more elegant way. I know there is a method ReturnsAsync()
but it has a parameter. My method returns just Task
so I don't have a parameter for ReturnsAsync()
.