public void Should_locate_single_command_processor() { //arrange var locator = new MessageProcessorLocator(new HostConfiguration { MessageProcessorProvider = _messageHandlerProvider }, new[] { _queueStarterFactory.Object }); _queueStarterFactory.Setup(x => x.CanCreate(typeof(TestCommand))).Returns(true); _queueStarterFactory.Setup(x => x.Create(typeof(TestCommand), null, typeof(TestTopicSettings), It.IsAny <HostConfiguration>(), It.IsAny <IMessageProcessor>())) .Returns(Mock.Of <IChannelReceiver>()).Verifiable(); _messageHandlerProvider.RegisterProcessor(new SingleCommandProcessor(Mock.Of <ICountable>())); //act var reader = Enumerable.ToList(locator.Locate()); //assert reader.Count.Should().Be(1); _queueStarterFactory.Verify(); }
public void Should_register_event_processor() { //arrange var provider = new StandardMessageProcessorProvider(); //act provider.RegisterProcessor(new EventProcessor(Mock.Of <ICountable>())); //assert provider.ListAllProcessors().Count().Should().Be(1); provider.ListAllProcessors().Should().Contain(x => x == typeof(EventProcessor)); }
public void Should_register_processor() { //arrange var provider = new StandardMessageProcessorProvider(); //act provider.RegisterProcessor(new SingleCommandProcessor(Mock.Of <ICountable>())); //assert provider.ListAllProcessors().Count().Should().Be(1); provider.ListAllProcessors().FirstOrDefault().Should().Be(typeof(SingleCommandProcessor)); }
public void Should_get_registered_event_processor() { //arrange var provider = new StandardMessageProcessorProvider(); var processor = new EventProcessor(Mock.Of <ICountable>()); provider.RegisterProcessor(processor); //act var processorFound = provider.GetProcessor <TestEvent>(typeof(IProcessEvent <TestEvent, TestSubscription, TestTopicSettings>)); //assert processorFound.Should().Be(processor); }
public void Should_get_registered_processor() { //arrange var provider = new StandardMessageProcessorProvider(); var processor = new SingleCommandProcessor(Mock.Of <ICountable>()); provider.RegisterProcessor(processor); //act var processorFound = provider.GetProcessor <TestCommand>(typeof(IProcessCommand <TestCommand, TestTopicSettings>)); //assert processorFound.Should().Be(processor); }