public void TestQueueService_DeleteMany() { var qa = new QueueAddressModel() { Name = "company.queues.finance6", ExchangeName = "Test.Exchange" }; var qa1 = new QueueAddressModel() { Name = "company.queues.finance7", ExchangeName = "Test.Exchange" }; var q = new QueueDeleteModel() { Name = "company.queues.finance6" }; var q1 = new QueueDeleteModel() { Name = "company.queues.finance7" }; List <QueueDeleteModel> qs = new List <QueueDeleteModel>() { q, q1 }; List <QueueAddressModel> qas = new List <QueueAddressModel>() { qa, qa1 }; BaseQueueService.DeclareMany(qas); // Assert Assert.DoesNotThrow(() => { BaseQueueService.DeleteMany(qs); }); }
public void TestQueueService_DeleteObject() { var q = new QueueDeleteModel() { Name = "Test.ExchangeWithQueues.Queue1" }; // Assert Assert.DoesNotThrow(() => { BaseQueueService.Delete(q); }); }
/// <summary> /// Deletes a single queue /// </summary> /// <param name="queue"></param> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="ServiceException"></exception> /// <exception cref="ValidationException"></exception> public void Delete(QueueDeleteModel queue) { try { Validate(queue, "Queue to delete cannot be null"); Channel.QueueDelete(queue.Name, queue.IfUnused, queue.IfEmpty); } catch (Exception ex) when(ex is ArgumentNullException || ex is ServiceException || ex is ValidationException) { throw; } catch (OperationInterruptedException ex) { Logger.Warn(ex.Message); throw new ServiceException("Queue Service Exception: Queue still in use or is not empty the likely cause, please see log for more details."); } catch (Exception ex) { Logger.Error(ex.Message); throw new ServiceException("Queue Service Exception: please see log for more details."); } }