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 })); }
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); }
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); }