public void AddEventHandler_can_handle_type_handling_multiple_Events(IServiceCollection services) { ServiceCollectionExtensions.AddEventHandler(services, typeof(MixedTestEventHandler)); Mock.Get(services).Verify(p => p.Add(It.Is <ServiceDescriptor>(sd => sd.ServiceType == typeof(IEventHandler <FirstTestEvent>) && sd.ImplementationType == typeof(MixedTestEventHandler)))); Mock.Get(services).Verify(p => p.Add(It.Is <ServiceDescriptor>(sd => sd.ServiceType == typeof(IEventHandler <SecondTestEvent>) && sd.ImplementationType == typeof(MixedTestEventHandler)))); }
public void AddEventHandler_registers_handler_by_its_type(IServiceCollection services) { ServiceCollectionExtensions.AddEventHandler(services, typeof(FirstTestEventHandler)); Mock.Get(services).Verify(p => p.Add(It.Is <ServiceDescriptor>(sd => sd.ServiceType == typeof(IEventHandler <FirstTestEvent>) && sd.ImplementationType == typeof(FirstTestEventHandler)))); }