/// <summary> /// Test container deletion, expecting success. /// </summary> /// <param name="testContainer">The container.</param> /// <param name="testAccessCondition">The access condition to use.</param> private void ContainerDeleteExpectLeaseSuccessAPM(CloudBlobContainer testContainer, AccessCondition testAccessCondition) { using (AutoResetEvent waitHandle = new AutoResetEvent(false)) { IAsyncResult result = testContainer.BeginDelete(testAccessCondition, null /* options */, null /* operationContext */, ar => waitHandle.Set(), null); waitHandle.WaitOne(); testContainer.EndDelete(result); } }
/// <summary> /// Test container deletion, expecting lease failure. /// </summary> /// <param name="testContainer">The container.</param> /// <param name="testAccessCondition">The failing access condition to use.</param> /// <param name="expectedErrorCode">The expected error code.</param> /// <param name="description">The reason why these calls should fail.</param> private void ContainerDeleteExpectLeaseFailureAPM(CloudBlobContainer testContainer, AccessCondition testAccessCondition, HttpStatusCode expectedStatusCode, string expectedErrorCode, string description) { using (AutoResetEvent waitHandle = new AutoResetEvent(false)) { IAsyncResult result = testContainer.BeginDelete(testAccessCondition, null /* options */, null /* operationContext */, ar => waitHandle.Set(), null); waitHandle.WaitOne(); TestHelper.ExpectedException( () => testContainer.EndDelete(result), description + " (Delete)", expectedStatusCode, expectedErrorCode); } }