public void CloudFileShareExistsAPM() { CloudFileShare share = GetRandomShareReference(); CloudFileShare share2 = share.ServiceClient.GetShareReference(share.Name); using (AutoResetEvent waitHandle = new AutoResetEvent(false)) { IAsyncResult result = share2.BeginExists( ar => waitHandle.Set(), null); waitHandle.WaitOne(); Assert.IsFalse(share2.EndExists(result)); share.Create(); try { result = share2.BeginExists( ar => waitHandle.Set(), null); waitHandle.WaitOne(); Assert.IsTrue(share2.EndExists(result)); Assert.IsNotNull(share2.Properties.ETag); } finally { share.Delete(); } result = share2.BeginExists( ar => waitHandle.Set(), null); waitHandle.WaitOne(); Assert.IsFalse(share2.EndExists(result)); } }