コード例 #1
0
        public void GetBlobMetadata_InvalidLeaseProvided_ThrowsArgumentException()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            client.GetBlobMetadata(containerName, blobName, InvalidLeaseId);

            // throws exception
        }
コード例 #2
0
        public void GetBlobMetadata_LeasedBlobWithMetadataNoLeaseProvided_GetsMetadata()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            var expectedMetadata = new Dictionary<string, string>
            {
                {"CaptainAmerica", "Shield"},
                {"Thor", "Hammer"},
                {"Me", "Code"}
            };
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName, expectedMetadata);
            _util.LeaseBlob(containerName, blobName);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var response = client.GetBlobMetadata(containerName, blobName);

            Assert.AreEqual(expectedMetadata, response.Metadata);
        }
コード例 #3
0
        public void GetBlobMetadata_LeasedBlobWithMetadataIncorrectLeaseProvided_ThrowsLeaseIdMismatchWithBlobOperationAzureException()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            var expectedMetadata = new Dictionary<string, string>
            {
                {"CaptainAmerica", "Shield"},
                {"Thor", "Hammer"},
                {"Me", "Code"}
            };
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName, expectedMetadata);
            _util.LeaseBlob(containerName, blobName);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            client.GetBlobMetadata(containerName, blobName, FakeLeaseId);

            // throws exception
        }
コード例 #4
0
        public void GetBlobMetadata_ExistingBlobWithNoMetadata_GetsEmptyMetadata()
        {
            var containerName = _util.GenerateSampleContainerName(_runId);
            var blobName = _util.GenerateSampleBlobName(_runId);
            var expectedMetadata = new Dictionary<string, string>();
            _util.CreateContainer(containerName);
            _util.CreateBlockBlob(containerName, blobName);
            IBlobServiceClient client = new BlobServiceClient(AccountSettings);

            var response = client.GetBlobMetadata(containerName, blobName);

            Assert.AreEqual(expectedMetadata, response.Metadata);
        }