Ejemplo n.º 1
0
        private static async Task RunBlobManagerTests(CloudStorageAccount storageAccount, string containerName, CancellationToken cancellationToken)
        {
            var blobManager = new BlobManager(containerName, storageAccount);

            await blobManager.CopyBlobAsync("test1.txt", "test1 - Copy of.txt", cancellationToken).ConfigureAwait(false);

            await blobManager.CopyBlobAsync("test2.txt", "test2 - Copy of.txt", cancellationToken).ConfigureAwait(false);

            await blobManager.UploadTextAsync("test4.txt", "Hello World", cancellationToken : cancellationToken).ConfigureAwait(false);

            await blobManager.AppendTextAsync("test4.txt", "\r\nqwerty", cancellationToken : cancellationToken).ConfigureAwait(false);

            await blobManager.AppendTextAsync("test4.txt", "\r\nazerty", cancellationToken : cancellationToken).ConfigureAwait(false);

            var blobs = await blobManager.ListBlobsAsync("test1", false, false, null, cancellationToken).ConfigureAwait(false);

            foreach (var blob in blobs)
            {
                Console.WriteLine(blob.Uri.AbsoluteUri);
            }

            await blobManager.DeleteBlobAsync("test1 - Copy of.txt", cancellationToken).ConfigureAwait(false);

            await blobManager.DeleteBlobAsync("test2 - Copy of.txt", cancellationToken).ConfigureAwait(false);

            await blobManager.DeleteBlobsWithPrefixAsync("test", cancellationToken).ConfigureAwait(false);
        }