public async void AccessBlobProvider_WhenContainerNoExists_ExceptionShouldBeThrown()
        {
            var uniqueContainerName = Guid.NewGuid().ToString("N");

            AzureBlobContainerClient blobProvider = GetTestBlobProvider(ConnectionString, uniqueContainerName);
            string blobName = Guid.NewGuid().ToString("N");

            // call function of blobProvider
            using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes("example")))
            {
                Assert.True(await blobProvider.CreateBlobAsync(blobName, stream, CancellationToken.None));
            }

            var blobServiceClient = new BlobServiceClient(ConnectionString);

            // delete the created container
            blobServiceClient.DeleteBlobContainer(uniqueContainerName);

            // call CreateBlobAsync() after the container is deleted by others
            using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes("new example")))
            {
                await Assert.ThrowsAsync <AzureBlobOperationFailedException>(() => blobProvider.CreateBlobAsync(blobName, stream, CancellationToken.None));
            }

            // call UploadStreamToBlobAsync()after the container is deleted by others
            using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes("new example")))
            {
                await Assert.ThrowsAsync <AzureBlobOperationFailedException>(() => blobProvider.UpdateBlobAsync(blobName, stream, CancellationToken.None));
            }

            // call GetBlobAsync() after the container is deleted by others
            await Assert.ThrowsAsync <AzureBlobOperationFailedException>(() => blobProvider.GetBlobAsync(blobName, CancellationToken.None));
        }
        public async void UpdateStreamToBlob_TheBlobShouldBeOverwriten()
        {
            var uniqueContainerName = Guid.NewGuid().ToString("N");

            AzureBlobContainerClient blobProvider = GetTestBlobProvider(ConnectionString, uniqueContainerName);
            string blobName = Guid.NewGuid().ToString("N");

            var blobContainerClient = new BlobContainerClient(ConnectionString, uniqueContainerName);
            var blobClient          = blobContainerClient.GetBlobClient(blobName);

            blobClient.DeleteIfExists();
            Assert.False(blobClient.Exists());

            // create a new blob
            string blobContent = "example";
            var    blobUrl_1   = await blobProvider.UpdateBlobAsync(blobName, new MemoryStream(Encoding.ASCII.GetBytes(blobContent)), CancellationToken.None);

            Assert.True(blobClient.Exists());

            using (var stream = new MemoryStream())
            {
                var res = await blobClient.DownloadToAsync(stream);

                stream.Position  = 0;
                using var reader = new StreamReader(stream);
                Assert.Equal(blobContent, reader.ReadToEnd());
            }

            // upload to a existing blob
            string newBlobContent = "new example";
            var    blobUrl_2      = await blobProvider.UpdateBlobAsync(blobName, new MemoryStream(Encoding.ASCII.GetBytes(newBlobContent)), CancellationToken.None);

            Assert.Equal(blobUrl_1, blobUrl_2);
            Assert.True(blobClient.Exists());

            using (var stream = new MemoryStream())
            {
                var res = await blobClient.DownloadToAsync(stream);

                stream.Position  = 0;
                using var reader = new StreamReader(stream);
                Assert.Equal(newBlobContent, reader.ReadToEnd());
            }

            await blobContainerClient.DeleteAsync();
        }