示例#1
0
        public async Task GetAllTopics()
        {
            IgnoreTestInLiveMode();
            //create ten queues
            for (int i = 0; i < 10; i++)
            {
                string topicName = Recording.GenerateAssetName("topic" + i.ToString());
                _ = await _topicCollection.CreateOrUpdateAsync(true, topicName, new ServiceBusTopicData());
            }

            //validate
            List<ServiceBusTopic> list = await _topicCollection.GetAllAsync().ToEnumerableAsync();
            Assert.AreEqual(10, list.Count);
            list = await _topicCollection.GetAllAsync(5, 5).ToEnumerableAsync();
            Assert.AreEqual(5, list.Count);
        }
 public async Task List()
 {
     #region Snippet:Managing_ServiceBusTopics_ListTopics
     await foreach (ServiceBusTopicResource serviceBusTopic in serviceBusTopicCollection.GetAllAsync())
     {
         Console.WriteLine(serviceBusTopic.Id.Name);
     }
     #endregion
 }