Example #1
0
        public void BaseBus_Send_MultipleHandlers_Ok()
        {
            var bus = new BaseBus();

            var handler1 = new TestHandler1();
            var handler2 = new TestHandler2();

            bus.Subscribe(handler1);
            bus.Subscribe(handler2);

            Enumerable.Repeat <Action>(() =>
            {
                string value = Guid.NewGuid().ToString();

                bus.Publish(new TestMessage()
                {
                    Data = value
                });

                Assert.True(handler1.Data == value);
                Assert.True(handler2.Data == value);
            }, 10);
        }
Example #2
0
        public void BaseBus_Send_Ok()
        {
            var bus = new BaseBus();

            string value = Guid.NewGuid().ToString();

            var handler = new TestHandler1();

            bus.Subscribe(handler);
            bus.Publish(new TestMessage()
            {
                Data = value
            });

            Assert.True(handler.Data == value);
        }