コード例 #1
0
        public void ListTablesSegmentedMaxResultsAPM()
        {
            CloudTableClient tableClient = GenerateCloudTableClient();

            TableResultSegment segment      = null;
            List <CloudTable>  totalResults = new List <CloudTable>();

            int segCount = 0;

            do
            {
                using (ManualResetEvent evt = new ManualResetEvent(false))
                {
                    IAsyncResult asyncRes = tableClient.BeginListTablesSegmented(string.Empty,
                                                                                 10,
                                                                                 segment != null ? segment.ContinuationToken : null,
                                                                                 null,
                                                                                 null,
                                                                                 (res) =>
                    {
                        evt.Set();
                    },
                                                                                 null);

                    evt.WaitOne();

                    segment = tableClient.EndListTablesSegmented(asyncRes);
                }

                Assert.IsTrue(segment.Count() <= 10);

                totalResults.AddRange(segment);
                segCount++;
            }while (segment.ContinuationToken != null);

            Assert.AreEqual(totalResults.Count, tableClient.ListTables().Count());
            Assert.IsTrue(segCount >= totalResults.Count / 10);
        }