public void SubscribeToCommand_registers_handler_instance(TestNybusConfigurator nybus, IServiceCollection services, FirstTestCommandHandler handler) { NybusConfiguratorExtensions.SubscribeToCommand <FirstTestCommand, FirstTestCommandHandler>(nybus, handler); nybus.ApplyServiceConfigurations(services); Mock.Get(services).Verify(p => p.Add(It.Is <ServiceDescriptor>(sd => sd.ServiceType == handler.GetType()))); }
public void SubscribeToCommand_registers_delegate_handler_type(TestNybusConfigurator nybus, IServiceCollection services, CommandReceivedAsync <FirstTestCommand> testHandler) { NybusConfiguratorExtensions.SubscribeToCommand(nybus, testHandler); nybus.ApplyServiceConfigurations(services); Mock.Get(services).Verify(p => p.Add(It.Is <ServiceDescriptor>(sd => sd.ServiceType == typeof(DelegateWrapperCommandHandler <FirstTestCommand>)))); }
public void RegisterErrorFilterProvider_adds_provider_with_custom_setup(TestNybusConfigurator nybus, IServiceCollection services, Func <IServiceProvider, IErrorFilterProvider> providerFactory) { NybusConfiguratorExtensions.RegisterErrorFilterProvider <TestErrorFilterProvider>(nybus, providerFactory); nybus.ApplyServiceConfigurations(services); Mock.Get(services).Verify(p => p.Add(It.Is <ServiceDescriptor>(sd => sd.ServiceType == typeof(IErrorFilterProvider) && sd.ImplementationFactory == providerFactory))); }
public void SubscribeToEvent_registers_handler_type(TestNybusConfigurator nybus, IServiceCollection services) { NybusConfiguratorExtensions.SubscribeToEvent <FirstTestEvent, FirstTestEventHandler>(nybus); nybus.ApplyServiceConfigurations(services); Mock.Get(services).Verify(p => p.Add(It.Is <ServiceDescriptor>(sd => sd.ServiceType == typeof(FirstTestEventHandler)))); }
public void UseRabbitMqBusEngine_registers_StaticQueueFactoryProvider(TestNybusConfigurator configurator, IServiceCollection services) { RabbitMqConfiguratorExtensions.UseRabbitMqBusEngine(configurator); configurator.ApplyServiceConfigurations(services); Mock.Get(services).Verify(p => p.Add(It.Is <ServiceDescriptor>(sd => sd.ServiceType == typeof(IQueueFactoryProvider) && sd.ImplementationType == typeof(StaticQueueFactoryProvider))), Times.Once); }
public void UseInMemoryBusEngine_registers_InMemory_bus_engine(TestNybusConfigurator nybus, IServiceCollection services) { InMemoryConfiguratorExtensions.UseInMemoryBusEngine(nybus); nybus.ApplyServiceConfigurations(services); Mock.Get(services).Verify(p => p.Add(It.Is <ServiceDescriptor>(sd => sd.ServiceType == typeof(IBusEngine) && sd.ImplementationType == typeof(InMemoryBusEngine)))); }