I'm trying to setup a method on a Mocked object that is async.
As the object is not crucial to my actual test, i just want the method to return an integer, which is its return type.
My code is below :-
_legacyUnitOfWorkMock.Setup(x => x.CommitAsync()).Returns(Task.FromResult<int>(1));
However, I get the following error message :-
System.NotSupportedException : Invalid setup on a non-virtual (overridable in VB) member: x => x.CommitAsync()
Can anyone point out why this code would fail?