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 SendToExistingQueueShouldNotCallCreate() { SetQueue(Substitute.For <System.Messaging.MessageQueue>(), true); using (var cut = CreateLocaleQueue("MyQueue", true, LocaleQueueMode.Durable)) { cut.Send("Message"); } _messageQueueManager.Received(0).Create(Arg.Any <string>(), Arg.Any <bool>(), Arg.Any <bool>()); _messageQueueManager.Received(1).Get(".", Arg.Any <string>(), Arg.Any <bool>(), Arg.Any <QueueAccessMode>()); }
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>()); }