public void Handle(UpdatePeerSubscriptionsCommand message)
        {
            var stopwatch      = Stopwatch.StartNew();
            var peerDescriptor = _peerRepository.UpdatePeerSubscriptions(message.PeerId, message.Subscriptions, message.TimestampUtc);

            if (peerDescriptor != null)
            {
                _bus.Publish(new PeerSubscriptionsUpdated(peerDescriptor));
            }
            _speedReporter.ReportSubscriptionUpdateDuration(stopwatch.Elapsed);
        }
Esempio n. 2
0
        public void UpdatePeerSubscriptionsCommand_should_have_meaningfull_to_string()
        {
            var id            = Guid.NewGuid();
            var subscriptions = new[]
            {
                Subscription.Matching <FakeRoutableCommandWithEnum>(x => x.Test1 == TestEnum1.Bar && x.Test2 == TestEnum2.Buz),
                Subscription.Matching <FakeRoutableCommand>(x => x.Id == 12 && x.OtherId == id)
            };
            var peerId  = new PeerId("Fake.Peer.Id");
            var command = new UpdatePeerSubscriptionsCommand(peerId, subscriptions, DateTime.Today);

            command.ToString()
            .ShouldEqual(
                $"PeerId: {peerId}, TimestampUtc: {DateTime.Today:yyyy-MM-dd HH:mm:ss.fff}, Subscriptions: [{string.Join(", ", subscriptions.AsEnumerable())}]");
        }