public void should_publish_messages_count() { _storage.Setup(x => x.GetNonAckedMessageCounts()) .Returns(new Dictionary <PeerId, int> { { new PeerId("Abc.Peer.0"), 42 } }); _handler.Handle(new PublishNonAckMessagesCountCommand()); _bus.ExpectExactly(new NonAckMessagesCountChanged(new[] { new NonAckMessage("Abc.Peer.0", 42) })); }
public void should_generate_snapshot_and_publish_it_to_the_specified_peer() { // Arrange var testBus = new TestBus(); var snapshotGenerator = new TestSnapshotGenerator(testBus, new TestSnapshot()); // Act var peerId = new PeerId("testPeerId"); snapshotGenerator.Handle(new SubscriptionsUpdated(new SubscriptionsForType(new MessageTypeId(typeof(TestEvent))), peerId)); // Assert testBus.ExpectExactly(peerId, new TestSnapshot()); }
public void should_publish_started_event() { var peerDescriptor = TestDataBuilder.CreatePersistentPeerDescriptor("tcp://abctest:123", typeof(FakeCommand)); var command = new RegisterPeerCommand(peerDescriptor); _handler.Handle(command); _bus.ExpectExactly(new PeerStarted(peerDescriptor)); }