public void NoRegister_Action_Should_NotInvoked() { var simpleEventBus = Create(); var mockEventNotify = new MockMessageNotify(simpleEventBus); var mockEventReceiver = new MockEventReceiver(); mockEventNotify.Send("ABC"); mockEventReceiver.Invoked.ShouldFalse(); }
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(); }
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(); }
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); }