-
-
Notifications
You must be signed in to change notification settings - Fork 798
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
Can ValueTask IReturnsResult<TMock> extensions be added? #437
Comments
@AdamDotNet - sounds like a sensible API enhancement. A couple of (fairly straightforward and unproblematic) things to keep in mind:
Would you like to submit a PR? (If so, please target the We should also consider feature parity with |
@stakx - I'd like to be able to help. However, I can't quite get in a compiling state before I get to work on it.
I tested adding
The template now runs, but the resulting |
@AdamDotNet: Given that you are using VS 2017, you should not have any problems with Moq.sln. I continue to be amazed by all the tooling-related unreliability that's cropped up lately in the .NET ecosystem and I have no idea what went wrong in your case. If you're on a Windows box, keep in mind that depending on how you downloaded Moq source code, Windows might block it (for security reasons) and you first need to "unblock" files in Explorer. Perhaps that's why your template doesn't run correctly? You can work without a functioning |
@stakx - In short,
Since it seems like I can write my extensions, I'll go ahead and proceed. |
@AdamDotNet , @JonHeaton - I just published a pre-release version 4.8.0-rc1 on NuGet. It has (among other things) support for |
The
ReturnsAsync()
andThrowsAsync()
are great, but sadly don't work with the newer type,ValueTask<T>
. I've cooked up a gist that shows it pretty simple to add (most of the changes wereTask
toValueTask
), though I didn't peruse through your unit tests, the cost could be a little higher to implement. Also, Moq would have to depend on the System.Threading.Tasks.Extensions NuGet. That seems like a small barrier, given it supports .NetStandard1.0.The idea is to merge in those extensions with your existing ReturnsExtension class.
I can live with adding these extensions to my own project or private NuGet, but it seems like a value add for everyone who uses the excellent Moq. Thank you!
The text was updated successfully, but these errors were encountered: