Beispiel #1
0
        public void AddDynamicSubscriber()
        {
            var submgr = new SubscriptionsManager();

            submgr.AddSubscriber <TestDynamicEventHandler>("Test");

            Assert.True(submgr.HasSubscribers("Test"));
            Assert.Single(submgr.GetSubscribers("Test"));
            Assert.Equal(typeof(TestDynamicEventHandler), submgr.GetSubscribers("Test").First().HandlerType);
        }
Beispiel #2
0
        public void AddGenericTypedSubscriber()
        {
            var submgr = new SubscriptionsManager();

            submgr.AddSubscriber(typeof(TestEvent), typeof(TestEventHandler));

            Assert.True(submgr.HasSubscribers <TestEvent>());
            Assert.Single(submgr.GetSubscribers <TestEvent>());
            Assert.Equal(typeof(TestEventHandler), submgr.GetSubscribers <TestEvent>().First().HandlerType);
        }