public async void LeaseBlobAcquireAsync_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); await client.LeaseBlobAcquireAsync(containerName, blobName); // expects exception }
public async void LeaseBlobAcquireAsync_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 = await client.LeaseBlobAcquireAsync(containerName, blobName, 30, expectedLeaseId); Assert.AreEqual(expectedLeaseId, response.LeaseId); _util.AssertBlobIsLeased(containerName, blobName, response.LeaseId); }
public async void LeaseBlobAcquireAsync_InvalidBlob_ThrowsBlobNotFoundException() { IBlobServiceClient client = new BlobServiceClient(AccountSettings); var containerName = GenerateSampleContainerName(); CreateContainer(containerName); var blobName = GenerateSampleBlobName(); await client.LeaseBlobAcquireAsync(containerName, blobName); // expects exception }
public async void LeaseBlobAcquireAsync_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 = await client.LeaseBlobAcquireAsync(containerName, blobName, infiniteLease); _util.AssertBlobIsLeased(containerName, blobName, response.LeaseId); }
public async void LeaseBlobAcquireAsync_AcquireLeaseForValidBlob_AcquiresLease() { const int leaseDuration = 30; IBlobServiceClient client = new BlobServiceClient(AccountSettings); var containerName = GenerateSampleContainerName(); var blobName = GenerateSampleBlobName(); CreateContainer(containerName); CreateBlockBlob(containerName, blobName); var response = await client.LeaseBlobAcquireAsync(containerName, blobName, leaseDuration); AssertBlobIsLeased(containerName, blobName, response.LeaseId); }