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 }
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); }
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 }
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); }