You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The C# compiler will bind the expression m.FindAsync(t => t.Id == 1, null, 0, 0) to the method overload without the includeProperties parameter, so verification should indeed tell you that the overload withincludeProperties wasn't called. There's nothing wrong here, as far as I can tell. If you want to call that other overload, e.g. add an additional , new string[0] to the argument list where you call that method.
(If I misunderstood something, please post a small but complete code example that demonstrates the issue; a small failing unit test would be best.)
Message: Moq.MockException :
Expected invocation on the mock once, but was 0 times: m => m.FindAsync(t => t.Id == 1, null, 0, 0, [])
No setups configured.
Performed invocations:
IDataStorage`1.FindAsync(t => (t.Id == 1), null, 0, 0)
It can not explicitly verify this call cause it adds [] and tries to verify an overloaded method, but action calls the one without that param.
CALLED: mock.Verify(m => m.FindAsync(t => t.Id == 1, null, 0, 0), Times.Once);
VERIFIED: mock.Verify(m => m.FindAsync(t => t.Id == 1, null, 0, 0, []), Times.Once);
The methods are:
Task FindAsync(
Expression<Func<T, bool>> filter = null,
Func<IQueryable, IOrderedQueryable> orderBy = null,
int skip = 0,
int take = 0,
params string[] includeProperties);
Task FindAsync(
Expression<Func<T, bool>> filter = null,
Func<IQueryable, IOrderedQueryable> orderBy = null,
int skip = 0,
int take = 0);
Even with a setup it does not work.
The text was updated successfully, but these errors were encountered: