public void GetQueueAttributesWithError() { var rsmq = new Rsmq(); Assert.Throws <QueueNotFoundException>(() => rsmq.GetQueueAttributes(new GetQueueAttributesOptions { QueueName = Global.QueueName })); Assert.Throws <InvalidFormatException>(() => rsmq.GetQueueAttributes(new GetQueueAttributesOptions { QueueName = Global.WrongQueueNameFormat })); }
public void GetQueueAttributes(CreateQueueOptions value) { var rsmq = new Rsmq(); rsmq.CreateQueue(value); var attributes = rsmq.GetQueueAttributes(new GetQueueAttributesOptions { QueueName = value.QueueName }); Assert.AreEqual(attributes.Delay, value.Delay); Assert.AreEqual(attributes.MaxSize, value.MaxSize); Assert.AreEqual(attributes.VisibilityTimer, value.VisibilityTimer); Assert.Zero(attributes.TotalSent); rsmq.SendMessage(new SendMessageOptions { QueueName = value.QueueName, Message = "Halo" }); attributes = rsmq.GetQueueAttributes(new GetQueueAttributesOptions { QueueName = value.QueueName }); Assert.AreEqual(1, attributes.TotalSent); }
public void SetQueueAttributes(SetQueueAttributesOptions value) { var rsmq = new Rsmq(); var defaultAttributes = new CreateQueueOptions { QueueName = value.QueueName }; rsmq.CreateQueue(defaultAttributes); var queueAttributes = rsmq.GetQueueAttributes(new GetQueueAttributesOptions { QueueName = value.QueueName }); Assert.AreEqual(defaultAttributes.Delay, queueAttributes.Delay); Assert.AreEqual(defaultAttributes.MaxSize, queueAttributes.MaxSize); Assert.AreEqual(defaultAttributes.VisibilityTimer, queueAttributes.VisibilityTimer); queueAttributes = rsmq.SetQueueAttributes(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); }