示例#1
0
        public void After_All_Subscriptions_Are_Deleted_Events_Should_No_Longer_Exists()
        {
            var subscriptionManager = new EventBusSubscriptionManager();

            subscriptionManager.AddSubscription <TestIntegrationEvent, TestIntegrationEventHandler>();
            subscriptionManager.RemoveSubscription <TestIntegrationEvent, TestIntegrationEventHandler>();
            Assert.False(subscriptionManager.HasSubscriptionsForEvent <TestIntegrationEvent>());
        }
示例#2
0
        public void Deleting_Last_Subscription_Should_Raise_On_Deleted_Event()
        {
            bool raised = false;
            var  subscriptionManager = new EventBusSubscriptionManager();

            subscriptionManager.OnEventRemoved += (o, e) => raised = true;
            subscriptionManager.AddSubscription <TestIntegrationEvent, TestIntegrationEventHandler>();
            subscriptionManager.RemoveSubscription <TestIntegrationEvent, TestIntegrationEventHandler>();
            Assert.True(raised);
        }
示例#3
0
 public void Unsubscribe <TEvent, THandler>()
     where TEvent : Event
     where THandler : IEventHandler <TEvent>
 {
     _subscriptionManager.RemoveSubscription <TEvent, THandler>();
 }