示例#1
0
        public async Task DeleteQueueAsync()
        {
            var rsmq = new Rsmq();
            await rsmq.CreateQueueAsync(new CreateQueueOptions { QueueName = Global.QueueName });

            Assert.AreEqual(1, (await rsmq.ListQueuesAsync()).Count());
            await rsmq.DeleteQueueAsync(new DeleteQueueOptions { QueueName = Global.QueueName });

            Assert.Zero((await rsmq.ListQueuesAsync()).Count());
        }
示例#2
0
        public async Task ListQueuesAsync()
        {
            var rsmq   = new Rsmq();
            var queues = await rsmq.ListQueuesAsync();

            Assert.Zero(queues.Count());

            await rsmq.CreateQueueAsync(new CreateQueueOptions { QueueName = Global.QueueName });

            queues = await rsmq.ListQueuesAsync();

            Assert.AreEqual(queues.Count(), 1);
            Assert.Contains(Global.QueueName, queues.ToArray());
        }
示例#3
0
        public async Task CreateQueueAsync(string value)
        {
            var rsmq = new Rsmq();

            Assert.AreEqual(1, await rsmq.CreateQueueAsync(new CreateQueueOptions {
                QueueName = value
            }));

            var queues = await rsmq.ListQueuesAsync();

            Assert.Contains(value, queues.ToArray());
        }
示例#4
0
        public async Task CreateQueueWithErrorAsync()
        {
            var rsmq = new Rsmq();

            Assert.ThrowsAsync <MissingParameterException>(async() => await rsmq.CreateQueueAsync(new CreateQueueOptions {
                QueueName = null
            }));
            Assert.ThrowsAsync <InvalidFormatException>(async() => await rsmq.CreateQueueAsync(new CreateQueueOptions {
                QueueName = Global.WrongQueueNameFormat
            }));

            var queues = await rsmq.ListQueuesAsync();

            Assert.Zero(queues.Count());
        }