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 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 SubscribeToCommand_subscribes_to_command_type(TestNybusConfigurator nybus, ISubscriptionBuilder subscriptionBuilder)
        {
            NybusConfiguratorExtensions.SubscribeToCommand <FirstTestCommand>(nybus);

            nybus.ApplySubscriptions(subscriptionBuilder);

            Mock.Get(subscriptionBuilder).Verify(p => p.SubscribeToCommand <FirstTestCommand>(typeof(ICommandHandler <FirstTestCommand>)));
        }
        public void SubscribeToCommand_registers_handler_instance_for_command(TestNybusConfigurator nybus, ISubscriptionBuilder subscriptionBuilder, FirstTestCommandHandler handler)
        {
            NybusConfiguratorExtensions.SubscribeToCommand <FirstTestCommand, FirstTestCommandHandler>(nybus, handler);

            nybus.ApplySubscriptions(subscriptionBuilder);

            Mock.Get(subscriptionBuilder).Verify(p => p.SubscribeToCommand <FirstTestCommand>(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 SubscribeToCommand_registers_delegate_handler_for_command(TestNybusConfigurator nybus, ISubscriptionBuilder subscriptionBuilder, CommandReceivedAsync <FirstTestCommand> testHandler)
        {
            NybusConfiguratorExtensions.SubscribeToCommand(nybus, testHandler);

            nybus.ApplySubscriptions(subscriptionBuilder);

            Mock.Get(subscriptionBuilder).Verify(p => p.SubscribeToCommand <FirstTestCommand>(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_async_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>)));
        }
        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))));
        }