Beispiel #1
0
 public async Task Create()
 {
     #region Snippet:Managing_ServiceBusQueues_CreateQueue
     string queueName = "myQueue";
     ServiceBusQueueResource serviceBusQueue = (await serviceBusQueueCollection.CreateOrUpdateAsync(WaitUntil.Completed, queueName, new ServiceBusQueueData())).Value;
     #endregion
 }
Beispiel #2
0
        public async Task CreateDeleteQueue()
        {
            IgnoreTestInLiveMode();
            //create queue
            string          queueName = Recording.GenerateAssetName("queue");
            ServiceBusQueue queue     = (await _queueCollection.CreateOrUpdateAsync(WaitUntil.Completed, 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.ExistsAsync(queueName));

            //delete queue
            await queue.DeleteAsync(WaitUntil.Completed);

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

            Assert.Null(queue);
            Assert.IsFalse(await _queueCollection.ExistsAsync(queueName));
        }
        public async Task CreateDeleteQueue()
        {
            IgnoreTestInLiveMode();
            //create queue
            string queueName = Recording.GenerateAssetName("queue");
            ServiceBusQueueResource queue = (await _queueCollection.CreateOrUpdateAsync(WaitUntil.Completed, queueName, new ServiceBusQueueData())).Value;

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

            //validate if created successfully
            Assert.IsTrue(await _queueCollection.ExistsAsync(queueName));
            queue = await _queueCollection.GetAsync(queueName);

            //delete queue
            await queue.DeleteAsync(WaitUntil.Completed);

            //validate
            var exception = Assert.ThrowsAsync <RequestFailedException>(async() => { await _queueCollection.GetAsync(queueName); });

            Assert.AreEqual(404, exception.Status);
            Assert.IsFalse(await _queueCollection.ExistsAsync(queueName));
        }