コード例 #1
0
        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())));
        }
コード例 #2
0
        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()));
        }