/// <summary> /// Scenario test for acquiring a lease. /// </summary> /// <param name="containerName">The name of the container.</param> /// <param name="blobName">The name of the blob, if any.</param> /// <param name="leaseDuration">The lease duration.</param> /// <param name="proposedLeaseId">The proposed lease ID.</param> /// <param name="expectedError">The error status code to expect.</param> /// <returns>The lease ID.</returns> public async Task <string> AcquireLeaseScenarioTest(string containerName, string blobName, int leaseDuration, string proposedLeaseId, HttpStatusCode?expectedError) { // Create and validate the web request HttpRequestMessage request = BlobTests.AcquireLeaseRequest(BlobContext, containerName, blobName, leaseDuration, proposedLeaseId, null); using (HttpResponseMessage response = await BlobTestUtils.GetResponse(request, BlobContext)) { BlobTests.AcquireLeaseResponse(response, proposedLeaseId, expectedError); return(BlobHttpResponseParsers.GetLeaseId(response)); } }