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 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>()); }
private System.Messaging.MessageQueue GetQueue(string name) { return(_messageQueueManager.Get(".", name, true, QueueAccessMode.SendAndReceive)); }