public void GetLocaleQueueWithQueueModeTempMasterShouldCreateQueue() { _messageQueueManager.Exists(Arg.Any <string>(), Arg.Any <bool>()).Returns(e => true); _messageQueueManager.Get(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <bool>(), Arg.Any <QueueAccessMode>()).Returns(new System.Messaging.MessageQueue()); using (var cut = CreateLocalQueue("MyQueue")) { cut.Connect(); } _messageQueueManager.Received(1).Create(Arg.Any <string>(), Arg.Any <bool>(), Arg.Any <bool>()); }
public void SendToNoneExistingQueueShouldCallCreate() { _messageQueueManager.Exists(Arg.Any <string>(), Arg.Any <bool>()).Returns(e => true); _messageQueueManager.Get(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <bool>(), Arg.Any <QueueAccessMode>()).Returns(new System.Messaging.MessageQueue()); using (var cut = CreateLocaleQueue()) { cut.Send("Message"); } _messageQueueManager.Received(1).Create(Arg.Any <string>(), Arg.Any <bool>(), Arg.Any <bool>()); }
public void SendToExistingQueueShouldGetQueueFromServer() { _messageQueueManager.Exists(Arg.Any <string>(), Arg.Any <bool>()).Returns(true); _messageQueueManager.Get(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <bool>(), Arg.Any <QueueAccessMode>()).Returns(Substitute.For <System.Messaging.MessageQueue>()); var cut = CreateRemoteQueue(RemoteQueueMode.Durable, AccessMode.Send); cut.Send("Message"); cut.ServerName.Should().Be("MyServerName"); _messageQueueManager.Received(0).Create(Arg.Any <string>(), Arg.Any <bool>(), Arg.Any <bool>()); _messageQueueManager.Received(1).Get("MyServerName", Arg.Any <string>(), Arg.Any <bool>(), Arg.Any <QueueAccessMode>()); }
public void DeleteLocaleQueueShouldDeleteQueue() { var name = $"IntegrationTest_{UniqueKeyUtility.Generate()}"; try { _messageQueueManager.Create(name, true, true); _messageQueueManager.Delete(name, true); TimerUtility.WaitForIt(() => !_messageQueueManager.Exists(name, true), 10000); _messageQueueManager.Exists(name, true).Should().BeFalse(); } finally { _messageQueueManager.Delete(name, true); } }
public void CreatePublicQueueShouldWork() { var name = $"IntegrationTest_{UniqueKeyUtility.Generate()}"; try { _messageQueueManager.Create(name, false, true).Should().NotBeNull(); _messageQueueManager.Exists(name, false).Should().BeFalse(); } finally { _messageQueueManager.Delete(name, false); } }
public void ConnectReconnectAndDisconnectShouldWork() { var name = $"IntegrationTest_{UniqueKeyUtility.Generate()}"; try { _messageQueueManager.Exists(name, true).Should().BeFalse(); using (var queue = CreateLocalQueue(name, true, LocaleQueueMode.DurableCreate, AccessMode.Send)) { queue.Disconnect(); queue.Connect(); queue.Reconnect(); queue.Disconnect(); queue.Connect(); queue.Reconnect(); queue.Disconnect(); } } finally { _messageQueueManager.Delete(name, true); } }