public void SetQueueAttributesWithError() { var rsmq = new Rsmq(); Assert.Throws <QueueNotFoundException>(() => rsmq.SetQueueAttributes(new SetQueueAttributesOptions { QueueName = Global.QueueName, MaxSize = 7453 })); rsmq.CreateQueue(new CreateQueueOptions { QueueName = Global.QueueName }); Assert.Throws <QueueNotFoundException>(() => rsmq.SetQueueAttributes(new SetQueueAttributesOptions { QueueName = Global.WrongQueueName, MaxSize = 3000 })); Assert.Throws <NoAttributeSuppliedException>(() => rsmq.SetQueueAttributes(new SetQueueAttributesOptions { QueueName = Global.QueueName })); Assert.Throws <InvalidValueException>(() => rsmq.SetQueueAttributes(new SetQueueAttributesOptions { QueueName = Global.QueueName, MaxSize = -34 })); }
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); }