public void Should_receive_a_message_pipeline_view() { IConsumePipe filter = CreateConsumePipe(); OneMessageConsumer consumer = GetOneMessageConsumer(); IConsumerFactory <OneMessageConsumer> factory = GetInstanceConsumerFactory(consumer); filter.ConnectConsumer(factory); }
public async Task Should_receive_a_message() { IConsumePipe filter = CreateConsumePipe(); OneMessageConsumer consumer = GetOneMessageConsumer(); IConsumerFactory <OneMessageConsumer> factory = GetInstanceConsumerFactory(consumer); filter.ConnectConsumer(factory); var consumeContext = new TestConsumeContext <MessageA>(new MessageA()); await filter.Send(consumeContext); await consumer.Task; }
public async Task Should_receive_a_two_messages() { IConsumePipe filter = CreateConsumePipe(); TwoMessageConsumer consumer = GetTwoMessageConsumer(); IConsumerFactory <TwoMessageConsumer> factory = GetInstanceConsumerFactory(consumer); filter.ConnectConsumer(factory); await filter.Send(new TestConsumeContext <MessageA>(new MessageA())); await filter.Send(new TestConsumeContext <MessageB>(new MessageB())); await consumer.TaskA; await consumer.TaskB; }
public async Task Should_invoke_post_consumer() { IConsumePipe filter = CreateConsumePipe(); TaskCompletionSource <MessageA> received = GetTask <MessageA>(); filter.ConnectConsumer(() => new OneMessageConsumer(received)); TestConsumeObserver <MessageA> interceptor = GetConsumeObserver <MessageA>(); filter.ConnectConsumeMessageObserver(interceptor); ConsumeContext consumeContext = GetConsumeContext(new MessageA()); await filter.Send(consumeContext); await received.Task; await interceptor.PostConsumed; }