コード例 #1
0
        public void handle_envelope_sent_then_message_failed_for_multiple_messages_to_the_same_node()
        {
            MessageHistory.StartListening();

            var envelope1 = new EnvelopeToken();
            var envelope2 = new EnvelopeToken();
            var node1 = new StubChannelNode();

            var messageWatcher = new MessageWatcher();

            messageWatcher.Handle(new EnvelopeSent(envelope1, node1));
            messageWatcher.Handle(new EnvelopeSent(envelope2, node1));

            MessageHistory.Outstanding().Count().ShouldEqual(2);

            envelope1.Destination = node1.Uri;
            messageWatcher.Handle(new MessageFailed
            {
                Envelope = envelope1
            });

            MessageHistory.Outstanding().Count().ShouldEqual(1);

            envelope2.Destination = node1.Uri;
            messageWatcher.Handle(new MessageFailed
            {
                Envelope = envelope2
            });

            MessageHistory.Outstanding().Any().ShouldBeFalse();
        }
コード例 #2
0
        public void handle_envelope_sent_then_message_successful_for_multiple_messages_to_the_same_node()
        {
            MessageHistory.ClearHistory();

            var envelope1 = new EnvelopeToken();
            var envelope2 = new EnvelopeToken();
            var node1     = new StubChannelNode();


            MessageHistory.Record(new EnvelopeSent(envelope1, node1).ToMessageTrack());
            MessageHistory.Record(new EnvelopeSent(envelope2, node1).ToMessageTrack());

            MessageHistory.Outstanding().Count().ShouldBe(2);

            envelope1.Destination = node1.Uri;

            MessageHistory.Record(new MessageSuccessful
            {
                Envelope = envelope1
            }.ToMessageTrack());


            MessageHistory.Outstanding().Count().ShouldBe(1);

            envelope2.Destination = node1.Uri;

            MessageHistory.Record(new MessageSuccessful
            {
                Envelope = envelope2
            }.ToMessageTrack());

            MessageHistory.Outstanding().Any().ShouldBeFalse();
        }
コード例 #3
0
        public void handle_envelope_sent_then_message_failed_for_multiple_messages_to_the_same_node()
        {
            MessageHistory.ClearHistory();

            var envelope1 = new EnvelopeToken();
            var envelope2 = new EnvelopeToken();
            var node1 = new StubChannelNode();

            MessageHistory.Record(new EnvelopeSent(envelope1, node1));
            MessageHistory.Record(new EnvelopeSent(envelope2, node1));

            MessageHistory.Outstanding().Count().ShouldBe(2);

            envelope1.Destination = node1.Uri;
            MessageHistory.Record(new MessageFailed
            {
                Envelope = envelope1
            });

            MessageHistory.Outstanding().Count().ShouldBe(1);

            envelope2.Destination = node1.Uri;
            MessageHistory.Record(new MessageFailed
            {
                Envelope = envelope2
            });

            MessageHistory.Outstanding().Any().ShouldBeFalse();
        }
コード例 #4
0
        public void handle_envelope_sent_then_message_failed_tracking_for_the_same_message_to_multiple_nodes()
        {
            MessageHistory.ClearHistory();

            var envelope1 = new EnvelopeToken();
            var node1     = new StubChannelNode();
            var node2     = new StubChannelNode();



            MessageHistory.Record(new EnvelopeSent(envelope1, node1));
            MessageHistory.Record(new EnvelopeSent(envelope1, node2));

            MessageHistory.Outstanding().Count().ShouldBe(2);

            envelope1.Destination = node1.Uri;
            MessageHistory.Record(new MessageFailed
            {
                Envelope = envelope1
            });

            MessageHistory.Outstanding().Count().ShouldBe(1);

            envelope1.Destination = node2.Uri;
            MessageHistory.Record(new MessageFailed
            {
                Envelope = envelope1
            });

            MessageHistory.Outstanding().Any().ShouldBeFalse();
        }
コード例 #5
0
        public void handle_envelope_sent_then_message_successful_tracking_for_the_same_message_to_multiple_nodes()
        {
            MessageHistory.StartListening();

            var envelope1 = new EnvelopeToken();
            var node1     = new StubChannelNode();
            var node2     = new StubChannelNode();

            var messageWatcher = new MessageWatcher();

            messageWatcher.Handle(new EnvelopeSent(envelope1, node1));
            messageWatcher.Handle(new EnvelopeSent(envelope1, node2));

            MessageHistory.Outstanding().Count().ShouldEqual(2);

            envelope1.Destination = node1.Uri;
            messageWatcher.Handle(new MessageSuccessful
            {
                Envelope = envelope1
            });

            MessageHistory.Outstanding().Count().ShouldEqual(1);

            envelope1.Destination = node2.Uri;
            messageWatcher.Handle(new MessageSuccessful
            {
                Envelope = envelope1
            });

            MessageHistory.Outstanding().Any().ShouldBeFalse();
        }
コード例 #6
0
        protected override void beforeEach()
        {
            node1 = new StubChannelNode();
            node2 = new StubChannelNode();
            node3 = new StubChannelNode();

            theMessage  = new Message();
            theEnvelope = new Envelope {
                Message = theMessage
            };

            theLogger = new RecordingLogger();
            Services.Inject <ILogger>(theLogger);

            modifiers = Services.CreateMockArrayFor <IEnvelopeModifier>(5);

            MockFor <ISubscriptionCache>().Stub(x => x.FindDestinationChannels(theEnvelope))
            .Return(new ChannelNode[] { node1, node2, node3 });

            correlationId = ClassUnderTest.Send(theEnvelope);
        }
        protected override void beforeEach()
        {
            destinationNode = new StubChannelNode("fake");

            replyUri = "fake://foo".ToUri();

            theMessage  = new Message();
            theEnvelope = new Envelope {
                Message = theMessage, ReplyRequested = theMessage.GetType().Name
            };

            theLogger = new RecordingLogger();
            Services.Inject <ILogger>(theLogger);

            MockFor <ISubscriptionCache>().Stub(x => x.FindDestinationChannels(theEnvelope))
            .Return(new ChannelNode[] { destinationNode });

            MockFor <ISubscriptionCache>().Stub(x => x.ReplyUriFor(destinationNode)).Return(replyUri);

            ClassUnderTest.Send(theEnvelope);
        }
コード例 #8
0
        public void handle_envelope_sent_then_message_successful_tracking_for_the_same_message_to_multiple_nodes()
        {
            MessageHistory.ClearHistory();

            var envelope1 = new EnvelopeToken();
            var node1 = new StubChannelNode();
            var node2 = new StubChannelNode();

            MessageHistory.Record(new EnvelopeSent(envelope1, node1).ToMessageTrack());
            MessageHistory.Record(new EnvelopeSent(envelope1, node2).ToMessageTrack());

            MessageHistory.Outstanding().Count().ShouldBe(2);

            envelope1.Destination = node1.Uri;

            MessageHistory.Record(new MessageSuccessful
            {
                Envelope = envelope1
            }.ToMessageTrack());

            MessageHistory.Outstanding().Count().ShouldBe(1);

            envelope1.Destination = node2.Uri;

            MessageHistory.Record(new MessageSuccessful
            {
                Envelope = envelope1
            }.ToMessageTrack());

            MessageHistory.Outstanding().Any().ShouldBeFalse();
        }
コード例 #9
0
        public void handle_envelope_sent_then_message_successful_tracking_for_the_same_message_to_multiple_nodes()
        {
            MessageHistory.StartListening();

            var envelope1 = new EnvelopeToken();
            var node1 = new StubChannelNode();
            var node2 = new StubChannelNode();

            var messageWatcher = new MessageWatcher();

            messageWatcher.Handle(new EnvelopeSent(envelope1, node1));
            messageWatcher.Handle(new EnvelopeSent(envelope1, node2));

            MessageHistory.Outstanding().Count().ShouldBe(2);

            envelope1.Destination = node1.Uri;
            messageWatcher.Handle(new MessageSuccessful
            {
                Envelope = envelope1
            });

            MessageHistory.Outstanding().Count().ShouldBe(1);

            envelope1.Destination = node2.Uri;
            messageWatcher.Handle(new MessageSuccessful
            {
                Envelope = envelope1
            });

            MessageHistory.Outstanding().Any().ShouldBeFalse();
        }