public void AddCommandHandler_can_handle_type_handling_multiple_commands(IServiceCollection services) { ServiceCollectionExtensions.AddCommandHandler(services, typeof(MixedTestCommandHandler)); Mock.Get(services).Verify(p => p.Add(It.Is <ServiceDescriptor>(sd => sd.ServiceType == typeof(ICommandHandler <FirstTestCommand>) && sd.ImplementationType == typeof(MixedTestCommandHandler)))); Mock.Get(services).Verify(p => p.Add(It.Is <ServiceDescriptor>(sd => sd.ServiceType == typeof(ICommandHandler <SecondTestCommand>) && sd.ImplementationType == typeof(MixedTestCommandHandler)))); }
public void AddCommandHandler_registers_handler_by_its_type_generic_syntax(IServiceCollection services) { ServiceCollectionExtensions.AddCommandHandler <FirstTestCommandHandler>(services); Mock.Get(services).Verify(p => p.Add(It.Is <ServiceDescriptor>(sd => sd.ServiceType == typeof(ICommandHandler <FirstTestCommand>) && sd.ImplementationType == typeof(FirstTestCommandHandler)))); }