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_handler_instance_for_command(TestNybusConfigurator nybus, ISubscriptionBuilder subscriptionBuilder, FirstTestEventHandler handler) { NybusConfiguratorExtensions.SubscribeToEvent <FirstTestEvent, FirstTestEventHandler>(nybus, handler); nybus.ApplySubscriptions(subscriptionBuilder); Mock.Get(subscriptionBuilder).Verify(p => p.SubscribeToEvent <FirstTestEvent>(handler.GetType())); }