Ejemplo n.º 1
0
        public void SendTo_WhenMessagHasBeenAddressedToTheSameConsumer_ReturnsItself(
            INotificationListener listener,
            EventStreamUpdated notification,
            EventStreamReaderId consumerId)
        {
            var addressedNotification = notification.SendTo(listener);

            Assert.Same(addressedNotification, addressedNotification.SendTo(listener));
        }
Ejemplo n.º 2
0
        public void SendTo_ChangesNotificationId(
            INotificationListener listener,
            EventStreamUpdated notification,
            EventStreamReaderId consumerId)
        {
            var addressedNotification = notification.SendTo(listener);

            Assert.NotEqual(notification.NotificationId, addressedNotification.NotificationId);
        }
Ejemplo n.º 3
0
 public void IsAddressedTo_WhenRecipientSpecifiedDirectly_ReturnsTrue(
     INotificationListener listener,
     EventStreamUpdated notification,
     EventStreamReaderId consumerId)
 {
     Assert.True(notification
                 .SendTo(listener)
                 .IsAddressedTo(listener));
 }
Ejemplo n.º 4
0
        public void SendTo_WhenMessagHasBeenAddressedToTheSameConsumer_SavesId(
            INotificationListener listener,
            EventStreamUpdated notification,
            EventStreamReaderId consumerId)
        {
            var addressedNotification = notification.SendTo(listener);

            Assert.Equal(
                addressedNotification.NotificationId,
                addressedNotification.SendTo(listener).NotificationId);
        }
Ejemplo n.º 5
0
 public void AddressedNotification_WhenRecipientIsDifferent_ReturnsFalse(
     ListenerType1 listener1,
     ListenerType2 listener2,
     EventStreamUpdated notification,
     EventStreamReaderId originalConsumer,
     EventStreamReaderId sendedConsumer)
 {
     Assert.False(notification
                  .SendTo(listener1)
                  .IsAddressedTo(listener2));
 }
Ejemplo n.º 6
0
        public void SendTo_PreservesNotificationPropertiesValues(
            INotificationListener listener,
            EventStreamUpdated notification,
            EventStreamReaderId consumerId)
        {
            var addressedNotification = (EventStreamUpdated)notification.SendTo(listener);

            Assert.Equal(notification.StreamName, addressedNotification.StreamName);
            Assert.Equal(notification.FromVersion, addressedNotification.FromVersion);
            Assert.Equal(notification.ToVersion, addressedNotification.ToVersion);
            Assert.Equal(notification.NotificationType, addressedNotification.NotificationType);
            Assert.Equal(notification.DeliveryCount, addressedNotification.DeliveryCount);
        }
        public async Task HandleNotificationAsync_WhenNotificationNotAddressedToConsumer_PropagatesNotificationToTheListener(
            [Frozen] Mock <INotificationListener> listenerMock,
            IEventStoreConnection connection,
            NotificationListenerSubscription subscription,
            EventStreamUpdated notification,
            EventStreamReaderId consumerId)
        {
            subscription.Start(connection);

            await subscription.HandleNotificationAsync(notification.SendTo(listenerMock.Object));

            listenerMock.Verify(
                self => self.On(notification),
                Times.Never());
        }