public void RemoveAllSubscriberConnectionsWhenASubscriberDisconnects() { Guid subscriberId = Guid.NewGuid(); Guid subscriptionId1 = Guid.NewGuid(); Guid subscriptionId2 = Guid.NewGuid(); AlwaysNotifyingEventSubscription subscription1 = new AlwaysNotifyingEventSubscription(subscriptionId1, subscriberId); AlwaysNotifyingEventSubscription subscription2 = new AlwaysNotifyingEventSubscription(subscriptionId2, subscriberId); this.repository.Setup(x => x.Get()).Returns(new[] { subscription1, subscription2 }); this.externalEventSubscriber.UnsubscribeAll(subscriberId); this.repository.Verify(x => x.Remove(subscriptionId1)); this.repository.Verify(x => x.Remove(subscriptionId2)); }
public AlwaysNotifyingEventIdMatcher(AlwaysNotifyingEventSubscription subscriptionToReturnOnMatch) { this.alwaysNotifyingEventSubscription = subscriptionToReturnOnMatch; }
public void Setup() { this.eventClientId = Guid.NewGuid(); this.eventId = Guid.NewGuid(); this.eventSubscriptionId = Guid.NewGuid(); this.eventSubscription = new AlwaysNotifyingEventSubscription(this.eventSubscriptionId, this.eventClientId); this.repository = new Mock<ISubscriptionRepository>(); IEventResourceToEventSubscriptionMatcher matcher = new AlwaysNotifyingEventIdMatcher(this.eventSubscription); var factory = new Mock<IEventResourceToSubscriptionMatcherFactory>(); factory.Setup(x => x.GetResourceMatchers()).Returns(new[] { matcher }); this.externalEventSubscriber = new ExternalEventSubscriber(this.repository.Object, factory.Object); }