I have a series of unit tests that connect to an Azure Storage emulator. In Setup my code checks if there is something listening on the emulator's port, and if not sets a flag StorageNotAvailable
.
In each of my tests I have some code...
if ( StorageNotAvailable )
Assert.Inconclusive( "Storage emulator is not available" )
// where storage emulator is available, continue as normal
As expected, when the test returns void
this reports correctly in the Test Explorer as "Inconclusive".
When the test is exercising some async methods, and the [TestMethod]
signature returns Task
then the test is reported in the TestExplorer as "Failed" instead of "Inconclusive".
How can I get an async method to report as Inconclusive?
EDIT
Some additional detail may be in order. Here are some sample tests I rigged up to demonstrate the problem I am seeing.
[TestMethod]
public void MyTestMethod()
{
Assert.Inconclusive( "I am inconclusive" );
}
[TestMethod]
public async Task MyTestMethodAsync()
{
Assert.Inconclusive( "I am an error" );
}
Some environment details may be in order as well:
- Windows 10 x64 1703 Build 15063.608
- Visual Studio Enterprise 2017 15.3.5
- .NET 4.7.02046
- VS Extensions that might be relevant
- Microsoft Visual Studio Test Platform
- MSTest V2 Create Unit Test Extension
- MSTest V2 IntelliTest Extension
- MSTest V2 Templates
- Project references that might be relevant
- Microsoft.VisualStudio.TestPlatform.TestFramework v14.0.0.0
- Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions v14.0.0.0
- Project nuGet packages that might be relevant
- MSTest.TestAdapter v1.1.18
- MSTest.TestFramework v1.1.18
- Project build target is .NET Framework v4.7