public void Should_send_message()
        {
            var someMessageHandler = new SomeMessageHandler();
            var eventAggregator    = new EventAggregator();

            eventAggregator.AddListener(someMessageHandler);
            eventAggregator.SendMessage <SomeMessage>();
            someMessageHandler.EventsTrapped.Count().ShouldEqual(1);
        }
        public void Can_unsubscribe_manually()
        {
            var someMessageHandler = new SomeMessageHandler();
            var eventAggregator    = new EventAggregator();

            eventAggregator.AddListener(someMessageHandler);
            eventAggregator.SendMessage <SomeMessage>();
            someMessageHandler.EventsTrapped.Count().ShouldEqual(1);


            eventAggregator.RemoveListener(someMessageHandler);
            eventAggregator.SendMessage <SomeMessage>();

            someMessageHandler.EventsTrapped.Count().ShouldEqual(1);
        }
        private void AddHandlerInScopeThatWillRemoveInstanceWhenGarbageCollected(IEventSubscriptionManager eventSubscriptionManager, bool?holdStrongReference = false)
        {
            var someMessageHandler = new SomeMessageHandler();

            eventSubscriptionManager.AddListener(someMessageHandler, holdStrongReference);
        }