protected void CreateConsumerMock(CorrelationIdState correlationIdState, string routingKey) { Consumer = MockRepository.GenerateStub<QueueingBasicConsumer>(); ConsumerWrapper = MockRepository.GenerateStub<QueueingBasicConsumerWrapper>(Consumer, Connection, Model); ConsumerWrapper.Stub(x => x.GetConsumer()) .Return(Consumer); SetupBasicProperties(correlationIdState); ConsumerWrapper.Stub(x => x.Dequeue()) .Return(new BasicDeliverEventArgs("", 0, false, "ex1", routingKey, BasicProperties, MessageData)); }
protected IBasicProperties SetupBasicProperties(CorrelationIdState correlationIdState) { BasicProperties = MockRepository.GenerateStub<IBasicProperties>(); BasicProperties.MessageId = MessageId; BasicProperties.ContentType = ContentType; BasicProperties.ContentEncoding = ContentEncoding; if (correlationIdState == CorrelationIdState.Use) BasicProperties.CorrelationId = CorrelationId; return BasicProperties; }
protected void CreateConsumerMock(CorrelationIdState correlationIdState) { CreateConsumerMock(correlationIdState, string.Empty); }
private void SetupListener(CorrelationIdState correlationIdState, bool rethrowExceptions = false, string routingKey = "") { BasicProperties = MockRepository.GenerateStub<IBasicProperties>(); CreateConsumerMock(correlationIdState, routingKey); SetupQueueEndpointProvider("testendpoint", "vhost", "testqueue"); SetupRabbitMqFactory(); SetupErrorHandler(rethrowExceptions); _listener = new ReceiveListener(QueueEndpointProvider, RabbitMqFactory, ChannelConfigurator, ErrorHandler); }