Esempio n. 1
0
        public void GetQueueAttributesWithErrorAsync()
        {
            var rsmq = new Rsmq();

            Assert.ThrowsAsync <QueueNotFoundException>(async() => await rsmq.GetQueueAttributesAsync(new GetQueueAttributesOptions {
                QueueName = Global.QueueName
            }));
            Assert.ThrowsAsync <InvalidFormatException>(async() => await rsmq.GetQueueAttributesAsync(new GetQueueAttributesOptions {
                QueueName = Global.WrongQueueNameFormat
            }));
        }
Esempio n. 2
0
        public async Task GetQueueAttributesAsync(CreateQueueOptions value)
        {
            var rsmq = new Rsmq();
            await rsmq.CreateQueueAsync(value);

            var attributes = await rsmq.GetQueueAttributesAsync(new GetQueueAttributesOptions { QueueName = value.QueueName });

            Assert.AreEqual(attributes.Delay, value.Delay);
            Assert.AreEqual(attributes.MaxSize, value.MaxSize);
            Assert.AreEqual(attributes.VisibilityTimer, value.VisibilityTimer);
            Assert.AreEqual(0, attributes.TotalSent);

            await rsmq.SendMessageAsync(new SendMessageOptions { QueueName = value.QueueName, Message = "Halo" });

            attributes = await rsmq.GetQueueAttributesAsync(new GetQueueAttributesOptions { QueueName = value.QueueName });

            Assert.AreEqual(1, attributes.TotalSent);
        }
Esempio n. 3
0
        public async Task SetQueueAttributesAsync(SetQueueAttributesOptions value)
        {
            var rsmq = new Rsmq();
            var defaultAttributes = new CreateQueueOptions {
                QueueName = value.QueueName
            };
            await rsmq.CreateQueueAsync(defaultAttributes);

            var queueAttributes = await rsmq.GetQueueAttributesAsync(new GetQueueAttributesOptions { QueueName = value.QueueName });

            Assert.AreEqual(defaultAttributes.Delay, queueAttributes.Delay);
            Assert.AreEqual(defaultAttributes.MaxSize, queueAttributes.MaxSize);
            Assert.AreEqual(defaultAttributes.VisibilityTimer, queueAttributes.VisibilityTimer);

            queueAttributes = await rsmq.SetQueueAttributesAsync(value);

            Assert.AreEqual(value.Delay ?? defaultAttributes.Delay, queueAttributes.Delay);
            Assert.AreEqual(value.MaxSize ?? defaultAttributes.MaxSize, queueAttributes.MaxSize);
            Assert.AreEqual(value.VisibilityTimer ?? defaultAttributes.VisibilityTimer, queueAttributes.VisibilityTimer);
        }