While trying to check the result of an asynchronous method I'm getting the below error.
Neither I tried await container.ExistsAsync().Result
nor bool result = await container.GetAwaiter().GetResult();
worked.
Where am I going wrong?
[TestMethod]
public async Task StorageAccountConnectionTest()
{
var storageCredentials = new StorageCredentials(_mockFuncXTransConfiguration.Object.StorageAccountName, _mockFuncXransConfiguration.Object.StorageAccountKey);
var cloudStorageAccount = new CloudStorageAccount(storageCredentials, true);
var cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
var container = cloudBlobClient.GetContainerReference(_mockFuncXTransConfiguration.Object.BlobName);
bool result = await container.ExistsAsync().Result;
Assert.AreEqual(true, result);
}