public async Task HandleNotificationAsync__WhenSubscriptionStoped_PropagateNotificationToTheListener( [Frozen] Mock <INotificationListener> listenerMock, IEventStoreConnection connection, NotificationListenerSubscription subscription, EventStreamUpdated notification) { subscription.Start(connection); await subscription.HandleNotificationAsync(notification); subscription.Stop(); await subscription.HandleNotificationAsync(notification); listenerMock.Verify( self => self.On(notification), Times.Once()); }
public async Task HandleNotificationAsync_WhenSubscriptionDidNotStart_NotPropagatesNotificationToTheListener( [Frozen] Mock <INotificationListener> listenerMock, NotificationListenerSubscription subscription, EventStreamUpdated notification) { await subscription.HandleNotificationAsync(notification); listenerMock.Verify( self => self.On(notification), Times.Never()); }
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()); }