public void LeaseBlobChange_LeasedBlobToNewLeaseId_ChangesToMatchNewLeaseId() { IBlobServiceClient client = new BlobServiceClient(AccountSettings); var containerName = _util.GenerateSampleContainerName(_runId); var blobName = _util.GenerateSampleBlobName(_runId); _util.CreateContainer(containerName); _util.CreateBlockBlob(containerName, blobName); var leaseId = _util.LeaseBlob(containerName, blobName); var expectedLeaseId = Guid.NewGuid().ToString(); var response = client.LeaseBlobChange(containerName, blobName, leaseId, expectedLeaseId); Assert.AreEqual(expectedLeaseId, response.LeaseId); _util.AssertBlobIsLeased(containerName, blobName, expectedLeaseId); }
public void LeaseBlobChange_NonexistentBlob_ThrowsBlobNotFoundException() { IBlobServiceClient client = new BlobServiceClient(AccountSettings); var containerName = _util.GenerateSampleContainerName(_runId); var blobName = _util.GenerateSampleBlobName(_runId); _util.CreateContainer(containerName); var expectedLeaseId = Guid.NewGuid().ToString(); client.LeaseBlobChange(containerName, blobName, FakeLeaseId, expectedLeaseId); // expects exception }
public void LeaseBlobChange_NonLeasedBlob_ThrowsLeaseNotPresentException() { IBlobServiceClient client = new BlobServiceClient(AccountSettings); var containerName = GenerateSampleContainerName(); var blobName = GenerateSampleBlobName(); CreateContainer(containerName); CreateBlockBlob(containerName, blobName); var expectedLeaseId = Guid.NewGuid().ToString(); client.LeaseBlobChange(containerName, blobName, FakeLeaseId, expectedLeaseId); // expects exception }