Пример #1
0
        public void TestDoubleAdd()
        {
            Msg1Sub sub = new Msg1Sub();

            bus.RegisterSubscriber(sub);

            Assert.ThrowsException <System.ArgumentException>(() => bus.RegisterSubscriber(sub));
        }
Пример #2
0
        public void UnregisterHandler()
        {
            var sub = new Msg1Sub();

            bus.RegisterSubscriber(sub);

            Assert.AreEqual(1, bus.SubscriberCount);
            bus.UnregisterSubscriber(sub);
            Assert.AreEqual(0, bus.SubscriberCount);

            bus.Send(new MyMessage1());
            AssertHandleCounts();
        }