Пример #1
0
        public async Task CreateDeleteQueue()
        {
            IgnoreTestInLiveMode();
            //create queue
            string          queueName = Recording.GenerateAssetName("queue");
            ServiceBusQueue queue     = (await _queueCollection.CreateOrUpdateAsync(queueName, new ServiceBusQueueData())).Value;

            Assert.NotNull(queue);
            Assert.AreEqual(queue.Id.Name, queueName);

            //validate if created successfully
            queue = await _queueCollection.GetIfExistsAsync(queueName);

            Assert.NotNull(queue);
            Assert.IsTrue(await _queueCollection.CheckIfExistsAsync(queueName));

            //delete queue
            await queue.DeleteAsync();

            //validate
            queue = await _queueCollection.GetIfExistsAsync(queueName);

            Assert.Null(queue);
            Assert.IsFalse(await _queueCollection.CheckIfExistsAsync(queueName));
        }
Пример #2
0
        public async Task GetIfExist()
        {
            #region Snippet:Managing_ServiceBusQueues_GetQueueIfExists
            ServiceBusQueue serviceBusQueue = await serviceBusQueueCollection.GetIfExistsAsync("foo");

            if (serviceBusQueue != null)
            {
                Console.WriteLine("queue 'foo' exists");
            }
            if (await serviceBusQueueCollection.CheckIfExistsAsync("bar"))
            {
                Console.WriteLine("queue 'bar' exists");
            }
            #endregion
        }