/// <summary>
        /// Scenario test for releasing 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="leaseId">The lease ID.</param>
        /// <param name="expectedError">The error status code to expect.</param>
        public async Task ReleaseLeaseScenarioTest(string containerName, string blobName, string leaseId, HttpStatusCode?expectedError)
        {
            // Create and validate the web request
            HttpRequestMessage request = BlobTests.ReleaseLeaseRequest(BlobContext, containerName, blobName, AccessCondition.GenerateLeaseCondition(leaseId));

            using (HttpResponseMessage response = await BlobTestUtils.GetResponse(request, BlobContext))
            {
                BlobTests.ReleaseLeaseResponse(response, expectedError);
            }
        }
Exemple #2
0
        /// <summary>
        /// Scenario test for releasing 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="leaseId">The lease ID.</param>
        /// <param name="expectedError">The error status code to expect.</param>
        public void ReleaseLeaseScenarioTest(string containerName, string blobName, string leaseId, HttpStatusCode?expectedError)
        {
            // Create and validate the web request
            HttpWebRequest request = BlobTests.ReleaseLeaseRequest(BlobContext, containerName, blobName, AccessCondition.GenerateLeaseCondition(leaseId));

            if (BlobContext.Credentials != null)
            {
                BlobTests.SignRequest(request, BlobContext);
            }

            using (HttpWebResponse response = BlobTestUtils.GetResponse(request, BlobContext))
            {
                BlobTests.ReleaseLeaseResponse(response, expectedError);
            }
        }