Exemple #1
0
        public void NoRegister_Action_Should_NotInvoked()
        {
            var simpleEventBus    = Create();
            var mockEventNotify   = new MockMessageNotify(simpleEventBus);
            var mockEventReceiver = new MockEventReceiver();

            mockEventNotify.Send("ABC");
            mockEventReceiver.Invoked.ShouldFalse();
        }
Exemple #2
0
        public void Register_Action_Should_Invoked()
        {
            var simpleEventBus    = Create();
            var mockEventNotify   = new MockMessageNotify(simpleEventBus);
            var mockEventReceiver = new MockEventReceiver();

            simpleEventBus.Register(@event =>
            {
                mockEventReceiver.Show(@event.Message);
            });

            mockEventNotify.Send("ABC");
            mockEventReceiver.Invoked.ShouldTrue();
        }
Exemple #3
0
        public void ClearActions_All_Should_NotInvoked()
        {
            var simpleEventBus    = Create();
            var mockEventNotify   = new MockMessageNotify(simpleEventBus);
            var mockEventReceiver = new MockEventReceiver();

            simpleEventBus.Register(@event =>
            {
                mockEventReceiver.Show(@event.Message);
            });

            simpleEventBus.ClearActions();

            mockEventNotify.Send("ABC");
            mockEventReceiver.Invoked.ShouldFalse();
        }
Exemple #4
0
        public void Raise_MultiTime_Should_Invoked()
        {
            var simpleEventBus    = Create();
            var mockEventNotify   = new MockMessageNotify(simpleEventBus);
            var mockEventReceiver = new MockEventReceiver();

            simpleEventBus.Register(@event =>
            {
                mockEventReceiver.Show(@event.Message);
            });

            mockEventNotify.Send("1");
            mockEventNotify.Send("2");
            mockEventNotify.Send("3");
            mockEventReceiver.Invoked.ShouldTrue();
            mockEventReceiver.InvokedCount.ShouldEqual(3);
        }