public void LeaseBlobAcquire_AlreadyLeasedBlob_ThrowsAlreadyPresentException() { IBlobServiceClient client = new BlobServiceClient(AccountSettings); var containerName = _util.GenerateSampleContainerName(_runId); var blobName = _util.GenerateSampleBlobName(_runId); _util.CreateContainer(containerName); _util.CreateBlockBlob(containerName, blobName); _util.LeaseBlob(containerName, blobName); client.LeaseBlobAcquire(containerName, blobName); // expects exception }
public void LeaseBlobAcquire_InvalidBlob_ThrowsBlobNotFoundException() { IBlobServiceClient client = new BlobServiceClient(AccountSettings); var containerName = _util.GenerateSampleContainerName(_runId); _util.CreateContainer(containerName); var blobName = _util.GenerateSampleBlobName(_runId); client.LeaseBlobAcquire(containerName, blobName); // expects exception }
public void LeaseBlobAcquire_AcquireInfiniteLeaseForValidBlob_AcquiresLease() { const int infiniteLease = -1; IBlobServiceClient client = new BlobServiceClient(AccountSettings); var containerName = _util.GenerateSampleContainerName(_runId); var blobName = _util.GenerateSampleBlobName(_runId); _util.CreateContainer(containerName); _util.CreateBlockBlob(containerName, blobName); var response = client.LeaseBlobAcquire(containerName, blobName, infiniteLease); _util.AssertBlobIsLeased(containerName, blobName, response.LeaseId); }
public void LeaseBlobAcquire_AcquireSpecificLeaseIdForValidBlob_AcquiresLease() { IBlobServiceClient client = new BlobServiceClient(AccountSettings); var containerName = _util.GenerateSampleContainerName(_runId); var blobName = _util.GenerateSampleBlobName(_runId); _util.CreateContainer(containerName); _util.CreateBlockBlob(containerName, blobName); var expectedLeaseId = Guid.NewGuid().ToString(); var response = client.LeaseBlobAcquire(containerName, blobName, 30, expectedLeaseId); Assert.AreEqual(expectedLeaseId, response.LeaseId); _util.AssertBlobIsLeased(containerName, blobName, response.LeaseId); }
public void LeaseBlobAcquire_AcquireLeaseForValidBlob_AcquiresLease() { const int leaseDuration = 30; IBlobServiceClient client = new BlobServiceClient(AccountSettings); var containerName = GenerateSampleContainerName(); var blobName = GenerateSampleBlobName(); CreateContainer(containerName); CreateBlockBlob(containerName, blobName); var response = client.LeaseBlobAcquire(containerName, blobName, leaseDuration); AssertBlobIsLeased(containerName, blobName, response.LeaseId); }