public void SetContainerMetadata_NonLeasedContainerWithLease_ThrowsLeaseNotPresentException() { IBlobServiceClient client = new BlobServiceClient(AccountSettings); var containerName = GenerateSampleContainerName(); CreateContainer(containerName); client.SetContainerMetadata(containerName, new Dictionary<string, string>() { { "a", "1"}, { "b", "2"} }, FakeLeaseId); // expects exception }
public void SetContainerMetadata_WrongLeasForLeasedContainer_ThrowsLeaseMismatchException() { IBlobServiceClient client = new BlobServiceClient(AccountSettings); var containerName = GenerateSampleContainerName(); CreateContainer(containerName); LeaseContainer(containerName, null, null); client.SetContainerMetadata(containerName, new Dictionary<string, string>() { { "a", "1"}, { "b", "2"} }, FakeLeaseId); // expects exception }
public void SetContainerMetadata_LeasedContainerWithLease_SetsMetadataOnContainer() { IBlobServiceClient client = new BlobServiceClient(AccountSettings); var containerName = GenerateSampleContainerName(); CreateContainer(containerName); var lease = LeaseContainer(containerName, null, null); client.SetContainerMetadata(containerName, new Dictionary<string, string>() { { "a", "1"}, { "b", "2"} }, lease); var metadata = GetContainerMetadata(containerName); Assert.IsNotNull(metadata); Assert.AreEqual(2, metadata.Count); Assert.IsTrue(metadata.Any(kvp => kvp.Key == "a" && kvp.Value == "1")); Assert.IsTrue(metadata.Any(kvp => kvp.Key == "b" && kvp.Value == "2")); }