Reputation: 1855
I'm running unit tests in ReSharper with NUnit 3.10.
I'm getting this error when doing a simple async test:
Method has non-void return value, but no result is expected
My test is literally:
[Test]
public async Task Nothing()
{
await Task.Delay(100);
}
It says in the documentation that this is in fact the correct way to run async tests.
Upvotes: 9
Views: 2718
Reputation: 114
For any Unity user that comes across this: I had the issue that I was using TestCaseSource
on a UnityTest
, which caused the above error message. Instead it is recommended to use ValueSource
: link.
Upvotes: 1
Reputation: 5827
For those working in Unity, make sure you are using the updated Test Framework Package, at least 2.0.1
. It is currently in pre-release so you will need to enable show pre-release
in the Package Manager.
Documentation here for more about the feature.
Upvotes: 7
Reputation: 1855
For me the issues was that instead of using a NuGet package, the references were to a DLL that's compiled targeting .NET Framework 3.5. Using a NuGet package of NUnit fixed it.
Upvotes: 0