public async Task TestDeleteBlobAsync() { using (ShimsContext.Create()) { connectionStrings.Add(new ConnectionStringSettings(AppSettings.SEVIS_DS2019_STORAGE_CONNECTION_STRING_KEY, "connection string")); string connectionString = settings.DS2019FileStorageConnectionString.ConnectionString; bool deleted = false; string blobName = "TestBlob"; string containerName = "ds2019"; var blobShim = new Microsoft.WindowsAzure.Storage.Blob.Fakes.ShimCloudBlockBlob { }; iBlobStorageSettings.Setup(x => x.CreateBlockBlob(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(blobShim); var shimContainer = new Microsoft.WindowsAzure.Storage.Blob.Fakes.ShimCloudBlobContainer { GetBlockBlobReferenceString = (blbnm) => { return(blobShim); } }; iBlobStorageSettings.Setup(x => x.BlobContainer("ds2019")) .Returns(shimContainer); Microsoft.WindowsAzure.Storage.Blob.Fakes.ShimCloudBlob.AllInstances.DeleteDeleteSnapshotsOptionAccessConditionBlobRequestOptionsOperationContext = (cBlob, snapOption, accCond, reqOpts, opsCont) => { deleted = true; }; Assert.IsFalse(deleted); service.DeleteBlob(blobName, containerName); Assert.IsTrue(deleted); deleted = false; Microsoft.WindowsAzure.Storage.Blob.Fakes.ShimCloudBlob.AllInstances.DeleteAsync = (cBlob) => { deleted = true; return(Task.FromResult <Object>(null)); }; Assert.IsFalse(deleted); await service.DeleteBlobAsync(blobName, containerName); Assert.IsTrue(deleted); } }