Пример #1
0
        public void should_not_generate_snapshot_if_snapshot_generator_returns_null()
        {
            // Arrange
            var testBus           = new TestBus();
            var snapshotGenerator = new TestSnapshotGenerator(testBus, null);

            // Act
            var peerId = new PeerId("testPeerId");

            snapshotGenerator.Handle(new SubscriptionsUpdated(new SubscriptionsForType(new MessageTypeId(typeof(TestEvent))), peerId));

            // Assert
            testBus.ExpectNothing();
        }
Пример #2
0
        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());
        }