コード例 #1
0
        public void CreateMessageSender_QueueIdIsNull_Exception()
        {
            var messagingComponentFactory = new MessagingComponentFactory(_configuration, _adapterFactory.Object, new IMessageSerializer[0],
                                                                          new IMessageDeserializer[0], _callContextFactory.Object);

            Assert.Throws <ArgumentNullException>(() => messagingComponentFactory.CreateMessageSender(null));
        }
コード例 #2
0
        public void CreateMessageReceiver_NoDeserializer_Exception()
        {
            var messagingComponentFactory = new MessagingComponentFactory(_configuration, _adapterFactory.Object, new IMessageSerializer[0],
                                                                          new IMessageDeserializer[0], _callContextFactory.Object);

            Assert.Throws <MessagingException>(() => messagingComponentFactory.CreateMessageReceiver <string>("ReValue"),
                                               "There are no message deserializers with the message type System.String for the queue id: ReValue");
        }
コード例 #3
0
        public void CreateMessageSender_CorrectQueueId_SenderCreated()
        {
            var messagingComponentFactory = new MessagingComponentFactory(_configuration, _adapterFactory.Object, new IMessageSerializer[0],
                                                                          new IMessageDeserializer[0], _callContextFactory.Object);
            var result = messagingComponentFactory.CreateMessageSender("ReValue");

            Assert.That(result, Is.Not.Null);
        }
コード例 #4
0
        public void CreateMessageReceiver_TwoDeserializers_Exception()
        {
            var deserializers = new List <IMessageDeserializer> {
                new PlainTextSerializer(), new PlainTextSerializer()
            };

            var messagingComponentFactory = new MessagingComponentFactory(_configuration, _adapterFactory.Object, new IMessageSerializer[0],
                                                                          deserializers, _callContextFactory.Object);

            Assert.Throws <MessagingException>(() => messagingComponentFactory.CreateMessageReceiver <string>("ReValue"),
                                               "There are too many message deserializers with the message type System.String for the queue id: ReValue");
        }
コード例 #5
0
        public void CreateMessageReceiver_HasDeserializer_ReceiverCreated()
        {
            var deserializers = new List <IMessageDeserializer> {
                new PlainTextSerializer()
            };

            var messagingComponentFactory = new MessagingComponentFactory(_configuration, _adapterFactory.Object, new IMessageSerializer[0],
                                                                          deserializers, _callContextFactory.Object);
            var result = messagingComponentFactory.CreateMessageReceiver <string>("ReValue");

            Assert.That(result, Is.Not.Null);
        }
コード例 #6
0
        public void CreateTransactedMessageReceiver_HasDeserializer_ReceiverCreated()
        {
            var adapterFactory = new Mock <IMessageAdapterFactory>();
            var messageAdapter = new Mock <IMessageAdapterWithTransactions>();

            adapterFactory.Setup(x => x.Create(It.IsAny <string>(), It.IsAny <bool>()))
            .Returns(messageAdapter.Object);

            var deserializers = new List <IMessageDeserializer> {
                new PlainTextSerializer()
            };

            var messagingComponentFactory = new MessagingComponentFactory(_configuration, adapterFactory.Object, new IMessageSerializer[0],
                                                                          deserializers, _callContextFactory.Object);

            var result = messagingComponentFactory.CreateTransactedMessageReceiver <object>("ReValue");

            Assert.That(result, Is.Not.Null);
        }