- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AddRangeAsync xunit .net core error #327
Comments
@zaiboot: Your code won't compile since it's incomplete so it's hard to reproduce your issue, but I guess this part of the error message is a sufficient hint at what is going wrong here:
This tells you that the first of your two setups (the one involving
If you add a _context.Setup(c => c.DBSet.AddRangeAsync(…))
.Returns((List<SomeModel> _, CancellationToken __) => Task.FromResult(true)); (Tried this the latest version of Moq, which is 4.7.25.) |
I do wonder, though, whether there should be a
|
I am closing this for now, since we have no working repro code and the reported error is quite possibly due to incorrect usage (see this comment further above). Regarding my previous comment just above, I think this would be better tracked in #384. @zaiboot: If the above does not help you, please report back and we take another look at your issue. |
This is quite likely a minimal repro code example for this issue: public interface IFoo
{
Task DoAsync();
}
var mock = new Mock<IFoo>(MockBehavior.Strict);
mock.Setup(m => m.DoAsync());
await mock.Object.DoAsync(); As noted above, one could argue that there should be a |
Running on:
I have the following code on my repositoryfile.cs
And the following test:
Getting the following error:
Seems like Moq doesnt support mocking
Task
vsTask<OfSomething>
.Any ideas on this? If you need more info I can set up a git repo to show the error in a more easy way.
Thanks
The text was updated successfully, but these errors were encountered: