Beispiel #1
0
        public void handle_chain_finished()
        {
            MessageHistory.StartListening();

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

            var messageWatcher = new MessageWatcher();

            messageWatcher.Handle(@event);

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

            messageWatcher.Handle(finished);

            var received = MessageHistory.Received().Single();

            received.Id.ShouldEqual(@event.Envelope.CorrelationId);
            received.Description.ShouldEqual(finished.ToString());
            received.Type.ShouldEqual(MessageWatcher.MessageTrackType);

            MessageHistory.Outstanding().Any().ShouldBeFalse();
        }
        public void track_received()
        {
            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.Received().Select(x => x.Id)
            .ShouldHaveTheSameElementsAs(foo1.Id.ToString(), foo2.Id.ToString(), foo3.Id.ToString());
        }
        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();
        }
        public void clear_all_absolutely_has_to_work()
        {
            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.ClearAll();

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