public void CloudTableDeleteAPM()
        {
            CloudTableClient tableClient = GenerateCloudTableClient();
            string           tableName   = GenerateRandomTableName();
            CloudTable       tableRef    = tableClient.GetTableReference(tableName);

            try
            {
                Assert.IsFalse(tableRef.Exists());
                tableRef.Create();
                Assert.IsTrue(tableRef.Exists());

                using (ManualResetEvent evt = new ManualResetEvent(false))
                {
                    IAsyncResult result = null;
                    tableRef.BeginDelete((res) =>
                    {
                        result = res;
                        evt.Set();
                    }, null);
                    evt.WaitOne();

                    tableRef.EndDelete(result);
                }

                Assert.IsFalse(tableRef.Exists());
            }
            finally
            {
                tableRef.DeleteIfExists();
            }
        }
        public void CloudTableDeleteWhenNotExistAPM()
        {
            CloudTableClient tableClient = GenerateCloudTableClient();
            string           tableName   = GenerateRandomTableName();
            CloudTable       tableRef    = tableClient.GetTableReference(tableName);
            OperationContext ctx         = new OperationContext();

            try
            {
                Assert.IsFalse(tableRef.Exists());

                using (ManualResetEvent evt = new ManualResetEvent(false))
                {
                    IAsyncResult result = null;
                    tableRef.BeginDelete(
                        null,
                        ctx,
                        (res) =>
                    {
                        result = res;
                        evt.Set();
                    },
                        null);
                    evt.WaitOne();

                    tableRef.EndDelete(result);
                }

                Assert.Fail();
            }
            catch (StorageException ex)
            {
                Assert.AreEqual(ex.RequestInformation.HttpStatusCode, 404);
                Assert.AreEqual(ex.RequestInformation.ExtendedErrorInformation.ErrorCode, "ResourceNotFound");
                TestHelper.AssertNAttempts(ctx, 1);
            }
            finally
            {
                tableRef.DeleteIfExists();
            }
        }