public void SubscribeToEvent_registers_handler_for_command(TestNybusConfigurator nybus, ISubscriptionBuilder subscriptionBuilder) { NybusConfiguratorExtensions.SubscribeToEvent <FirstTestEvent, FirstTestEventHandler>(nybus); nybus.ApplySubscriptions(subscriptionBuilder); Mock.Get(subscriptionBuilder).Verify(p => p.SubscribeToEvent <FirstTestEvent>(typeof(FirstTestEventHandler))); }
public void SubscribeToEvent_registers_handler_instance(TestNybusConfigurator nybus, IServiceCollection services, FirstTestEventHandler handler) { NybusConfiguratorExtensions.SubscribeToEvent <FirstTestEvent, FirstTestEventHandler>(nybus, handler); nybus.ApplyServiceConfigurations(services); Mock.Get(services).Verify(p => p.Add(It.Is <ServiceDescriptor>(sd => sd.ServiceType == handler.GetType()))); }
public void SubscribeToEvent_registers_delegate_handler_type(TestNybusConfigurator nybus, IServiceCollection services, EventReceivedAsync <FirstTestEvent> testHandler) { NybusConfiguratorExtensions.SubscribeToEvent(nybus, testHandler); nybus.ApplyServiceConfigurations(services); Mock.Get(services).Verify(p => p.Add(It.Is <ServiceDescriptor>(sd => sd.ServiceType == typeof(DelegateWrapperEventHandler <FirstTestEvent>)))); }
public void SubscribeToEvent_subscribes_to_command_type(TestNybusConfigurator nybus, ISubscriptionBuilder subscriptionBuilder) { NybusConfiguratorExtensions.SubscribeToEvent <FirstTestEvent>(nybus); nybus.ApplySubscriptions(subscriptionBuilder); Mock.Get(subscriptionBuilder).Verify(p => p.SubscribeToEvent <FirstTestEvent>(typeof(IEventHandler <FirstTestEvent>))); }
public void SubscribeToEvent_registers_delegate_handler_for_command(TestNybusConfigurator nybus, ISubscriptionBuilder subscriptionBuilder, EventReceivedAsync <FirstTestEvent> testHandler) { NybusConfiguratorExtensions.SubscribeToEvent(nybus, testHandler); nybus.ApplySubscriptions(subscriptionBuilder); Mock.Get(subscriptionBuilder).Verify(p => p.SubscribeToEvent <FirstTestEvent>(typeof(DelegateWrapperEventHandler <FirstTestEvent>))); }