public void MessageDispatcher_DispatchCustomerCreatedEventTest() { Apworks.Bus.IMessageDispatcher messageDispatcher = Apworks.Bus.MessageDispatcher.CreateAndRegister(application.ConfigSource, typeof(Apworks.Bus.MessageDispatcher)); MessageDispatchEventArgs evtArgs = null; messageDispatcher.Dispatched += (s, e) => { evtArgs = e; }; var message = new Apworks.Tests.Common.Events.CreateCustomerDomainEvent(); messageDispatcher.DispatchMessage(message); Assert.IsNotNull(evtArgs); Assert.AreEqual <Type>(typeof(Apworks.Tests.Common.MessageHandlers.CustomerCreatedEventHandler), evtArgs.HandlerType); }
public void MessageDispatcher_DispachEmailChangedEventTest() { Apworks.Bus.IMessageDispatcher messageDispatcher = Apworks.Bus.MessageDispatcher.CreateAndRegister(application.ConfigSource, typeof(Apworks.Bus.MessageDispatcher)); MessageDispatchEventArgs evtFail = null; MessageDispatchEventArgs evtSuccess = null; messageDispatcher.DispatchFailed += (s, e) => { evtFail = e; }; messageDispatcher.Dispatched += (s, e) => { evtSuccess = e; }; var message = new Apworks.Tests.Common.Events.ChangeEmailDomainEvent(); messageDispatcher.DispatchMessage(message); //Assert.IsNotNull(evtFail); //Assert.IsNotNull(evtSuccess); Assert.AreEqual <Type>(typeof(Apworks.Tests.Common.MessageHandlers.YetAnotherEmailChangedEventHandler), evtFail.HandlerType); Assert.AreEqual <Type>(typeof(Apworks.Tests.Common.MessageHandlers.EmailChangedEventHandler), evtSuccess.HandlerType); }
public void MessageDispatcher_CreateTest() { Apworks.Bus.IMessageDispatcher messageDispatcher = Apworks.Bus.MessageDispatcher.CreateAndRegister(application.ConfigSource, typeof(Apworks.Bus.MessageDispatcher)); Assert.IsNotNull(messageDispatcher); }