示例#1
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();
        }
示例#2
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();
        }
示例#3
0
        public void handle_chain_started()
        {
            MessageHistory.ClearHistory();

            var @event = new ChainExecutionStarted
            {
                ChainId = Guid.NewGuid(), Envelope = new EnvelopeToken()
            };


            var sent = @event.ToMessageTrack();

            sent.Id.ShouldBe(@event.Envelope.CorrelationId);
            sent.Description.ShouldBe(@event.ToString());
            sent.Type.ShouldBe(MessageLogRecord.MessageTrackType);
        }
示例#4
0
        public void coordinate_message_history_via_remote_service_and_clear_data_does_not_remove_listeners()
        {
            using (var runner = RemoteServiceRunner.For <SampleBootstrapper>())
            {
                runner.WaitForServiceToStart <SampleService.SampleService>();
                runner.WaitForServiceToStart <SampleService.RemoteService>();

                MessageHistory.ConnectRemoteListeners(runner);
                MessageHistory.ClearHistory();

                var foo = new Foo();

                GlobalMessageTracking.SentMessage(foo);


                GlobalMessageTracking.Messaging.WaitForMessage <AllMessagesComplete>(() => runner.SendRemotely(foo))
                .ShouldNotBeNull();
            }
        }
示例#5
0
        public void clear_history_removes_all()
        {
            var foo1 = new Foo();
            var foo2 = new Foo();
            var foo3 = new Foo();

            MessageHistory.Record(MessageTrack.ForReceived(foo1));
            MessageHistory.Record(MessageTrack.ForReceived(foo2));
            MessageHistory.Record(MessageTrack.ForReceived(foo3));

            MessageHistory.Record(MessageTrack.ForSent(foo1));
            MessageHistory.Record(MessageTrack.ForSent(foo2));
            MessageHistory.Record(MessageTrack.ForSent(foo3));

            MessageHistory.ClearHistory();

            MessageHistory.Outstanding().Any().ShouldBeFalse();
            MessageHistory.Received().Any().ShouldBeFalse();
            MessageHistory.All().Any().ShouldBeFalse();
        }
示例#6
0
        public void handle_chain_finished()
        {
            MessageHistory.ClearHistory();

            var @event = new ChainExecutionStarted
            {
                ChainId  = Guid.NewGuid(),
                Envelope = new EnvelopeToken()
            };

            var finished = new ChainExecutionFinished
            {
                ChainId  = @event.ChainId,
                Envelope = @event.Envelope
            };

            var received = finished.ToMessageTrack();

            received.Id.ShouldBe(@event.Envelope.CorrelationId);
            received.Description.ShouldBe(finished.ToString());
            received.Type.ShouldBe(MessageLogRecord.MessageTrackType);

            MessageHistory.Outstanding().Any().ShouldBeFalse();
        }
示例#7
0
 protected static void startListening()
 {
     MessageHistory.ClearHistory();
 }