public async Task ParallelDownloadSlowTest() { string inputFileName = Path.GetTempFileName(); string outputFileName = Path.GetTempFileName(); CloudBlobContainer container = GetRandomContainerReference(); try { await container.CreateAsync(); CloudBlockBlob blob = container.GetBlockBlobReference("largeblob1"); long bufferSize = 12 * Constants.KB; long offSet = 0; using (FileStream file = new FileStream(inputFileName, FileMode.Create, FileAccess.Write)) { while (offSet < 12 * Constants.MB) { byte[] buffer = GetRandomBuffer(bufferSize); await file.WriteAsync(buffer, 0, buffer.Length); offSet += bufferSize; } } BlobRequestOptions options = new BlobRequestOptions(); options.ParallelOperationThreadCount = 16; await blob.UploadFromFileAsync(inputFileName, null, options, null); int parallelIOCount = 2; long rangeSizeInBytes = 4 * Constants.MB; CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); DelayingDownloadRangeCloudBlob wrapperBlob = new DelayingDownloadRangeCloudBlob(blob.SnapshotQualifiedUri, blob.ServiceClient, 1000, 1000000); await ParallelDownloadToFile.Start(wrapperBlob, outputFileName, FileMode.Create, parallelIOCount, rangeSizeInBytes, 0, null, 10000 /* Amount of time to wait before abort / retry */, null, null, null, CancellationToken.None).Task; await blob.DeleteAsync(); Assert.IsTrue(FilesAreEqual(inputFileName, outputFileName)); } finally { container.DeleteIfExists(); File.Delete(inputFileName); File.Delete(outputFileName); } }