Пример #1
0
        public void Basic_functionality_works()
        {
            var sub = new TheSubscriber();

            _bus.Subscribe(sub);
            _bus.Publish(new NormalMessage());
            _bus.Publish(new SpecialMessage());
            sub.NormalMsgCount.ShouldBeEqualTo(1);
            sub.SpecialMsgCount.ShouldBeEqualTo(1);
        }
Пример #2
0
        public void Dispose_works()
        {
            var sub = new TheSubscriber();

            _bus.Subscribe(sub);
            sub.Dispose();
            _bus.Publish(new NormalMessage());
            _bus.Publish(new SpecialMessage());
            sub.NormalMsgCount.ShouldBeEqualTo(0);
            sub.SpecialMsgCount.ShouldBeEqualTo(0);
        }
Пример #3
0
        public void The_special_shape_is_applied()
        {
            var sub = new TheSubscriber();

            _bus.Subscribe(sub);
            _bus.Publish(new NormalMessage());
            _bus.Publish(new SpecialMessage());
            sub.NormalMsgCount.ShouldBeEqualTo(1);
            sub.SpecialMsgCount.ShouldBeEqualTo(1);
            sub.Suspend();
            _bus.Publish(new NormalMessage());
            _bus.Publish(new SpecialMessage());
            sub.NormalMsgCount.ShouldBeEqualTo(2);
            sub.SpecialMsgCount.ShouldBeEqualTo(1);
            sub.Resume();
            _bus.Publish(new NormalMessage());
            _bus.Publish(new SpecialMessage());
            sub.NormalMsgCount.ShouldBeEqualTo(3);
            sub.SpecialMsgCount.ShouldBeEqualTo(2);
        }