public void DeleteBlob_NonExistingBlob_ThrowsBlobDoesNotExistException()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            var client = new BlobServiceClient(AccountSettings);

            // delete blob that doesn't exist => should throw an exception
            client.DeleteBlob(containerName, blobName);
        }
        public void DeleteBlob_LeasedBlobWithInvalidLeaseGiven_ThrowsArgumentException()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            var client = new BlobServiceClient(AccountSettings);

            client.DeleteBlob(containerName, blobName, leaseId: InvalidLeaseId);

            // throw exception
        }
        public void DeleteBlob_LeasedBlobWithIncorrectLeaseGiven_ThrowsLeaseIdMismatchWithBlobOperationAzureException()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName);
            _util.LeaseBlob(containerName, blobName);
            var client = new BlobServiceClient(AccountSettings);

            client.DeleteBlob(containerName, blobName, leaseId: GetGuidString());

            // throw exception
        }
        public void DeleteBlob_LeasedBlobWithNoLeaseGiven_ThrowsLeaseIdMissingAzureException()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName);
            _util.LeaseBlob(containerName, blobName);
            var client = new BlobServiceClient(AccountSettings);

            client.DeleteBlob(containerName, blobName);

            // throw exception
        }
        public void DeleteBlob_LeasedBlobCorrectLeaseSpecified_DeletesBlob()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName);
            var lease = _util.LeaseBlob(containerName, blobName);
            var client = new BlobServiceClient(AccountSettings);

            client.DeleteBlob(containerName, blobName, leaseId: lease);

            _util.AssertBlobDoesNotExist(containerName, blobName, BlobType.BlockBlob);
        }
        public void DeleteBlob_ExistingBlob_DeletesBlob()
        {
            var expectedContent = "Expected blob content";
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName, content: expectedContent);
            var client = new BlobServiceClient(AccountSettings);

            client.DeleteBlob(containerName, blobName);

            _util.AssertBlobDoesNotExist(containerName, blobName, BlobType.BlockBlob);
        }