Beispiel #1
0
        public void RabbitMQBinding_NonTransactionalDuplexWithPredefinedCallbackQueueDelivery()
        {
            IDuplexService channel = _channelFactory.CreateChannel();

            Data data = new Data
            {
                Id   = 1,
                Name = "Rabbit"
            };

            A.CallTo(_errorProcessorFake).DoesNothing();
            A.CallTo(() => _callbackFake.Say(A <Data> .Ignored)).Invokes(() => _ev.Set());

            channel.Say(data);

            bool wait = _ev.Wait(TimeSpan.FromSeconds(10));

            Assert.IsTrue(wait, "Callback were not being invoked");

            A.CallTo(() => _processorFake.Say(A <Data> ._)).WhenArgumentsMatch(collection =>
            {
                data.ShouldBeEquivalentTo(collection[0]);

                return(true);
            }).MustHaveHappened(Repeated.Like(i => i == 1));

            A.CallTo(() => _callbackFake.Say(A <Data> ._)).WhenArgumentsMatch(collection =>
            {
                _replyData.ShouldBeEquivalentTo(collection[0]);

                return(true);
            }).MustHaveHappened(Repeated.Like(i => i == 1));
        }
Beispiel #2
0
        public void Say(Data data)
        {
            _process.Say(data);

            IDuplexService callbackChannel = OperationContext.Current.GetCallbackChannel <IDuplexService>();

            callbackChannel.Say(_replyData);
        }