public void CloudBlobContainerCreateIfNotExistsAPM() { CloudBlobContainer container = GetRandomContainerReference(); try { using (AutoResetEvent waitHandle = new AutoResetEvent(false)) { IAsyncResult result = container.BeginCreateIfNotExists( ar => waitHandle.Set(), null); waitHandle.WaitOne(); Assert.IsTrue(container.EndCreateIfNotExists(result)); result = container.BeginCreateIfNotExists( ar => waitHandle.Set(), null); waitHandle.WaitOne(); Assert.IsFalse(container.EndCreateIfNotExists(result)); } } finally { container.DeleteIfExists(); } }