public void CloudQueueClientGetServiceStatsAPM()
        {
            AssertSecondaryEndpoint();

            CloudQueueClient client = GenerateCloudQueueClient();

            client.DefaultRequestOptions.LocationMode = LocationMode.SecondaryOnly;
            using (AutoResetEvent waitHandle = new AutoResetEvent(false))
            {
                IAsyncResult result = client.BeginGetServiceStats(
                    ar => waitHandle.Set(),
                    null);
                waitHandle.WaitOne();
                TestHelper.VerifyServiceStats(client.EndGetServiceStats(result));

                result = client.BeginGetServiceStats(
                    null,
                    new OperationContext(),
                    ar => waitHandle.Set(),
                    null);
                waitHandle.WaitOne();
                TestHelper.VerifyServiceStats(client.EndGetServiceStats(result));
            }
        }
        public void CloudQueueClientGetServiceStatsInvalidLocAPM()
        {
            CloudQueueClient client = GenerateCloudQueueClient();

            client.DefaultRequestOptions.LocationMode = LocationMode.PrimaryOnly;
            try
            {
                using (AutoResetEvent waitHandle = new AutoResetEvent(false))
                {
                    IAsyncResult result = client.BeginGetServiceStats(
                        ar => waitHandle.Set(),
                        null);
                    waitHandle.WaitOne();
                }

                Assert.Fail("GetServiceStats should fail and throw an InvalidOperationException.");
            }
            catch (Exception e)
            {
                Assert.IsInstanceOfType(e, typeof(InvalidOperationException));
            }
        }