Exemple #1
0
 public MessageProcessorShould()
 {
     _spyLogger        = new SpyLogger <MessageProcessor <MyEvent> >();
     _mockHandler      = new Mock <IMessageHandler <MyEvent> >();
     _mockSerialiser   = new Mock <IMessageSerialiser>();
     _mockInstrumentor = new Mock <IInstrumentor>();
     _processor        = new MessageProcessor <MyEvent>(_spyLogger, _mockSerialiser.Object, _mockHandler.Object, _mockInstrumentor.Object);
 }
 public MessageSendingGatewayShould()
 {
     _spyLogger                = new SpyLogger <MessageSendingGateway <MyEndpointConfig> >();
     _mockSerialiser           = new Mock <IMessageSerialiser>();
     _mockInstrumentor         = new Mock <IInstrumentor>();
     _mockMessageSenderFactory = new Mock <IMessageSenderFactory>();
     _mockSender               = new Mock <IMessageSender>();
     _mockSerialiser.Setup(s => s.Serialise(MyEvent.Default)).Returns(SerialisedBytes);
     _mockSender.Setup(m => m.Path).Returns(_options.EntityPath);
     _mockMessageSenderFactory.Setup(m => m.CreateMessageSender(_options, null)).Returns(_mockSender.Object);
     _outboundGateway = new MessageSendingGateway <MyEndpointConfig>(
         _spyLogger,
         _mockSerialiser.Object,
         _mockInstrumentor.Object,
         _mockMessageSenderFactory.Object,
         _options);
 }
Exemple #3
0
        public SingleMessageTypeListenerShould()
        {
            _spyLogger                  = new SpyLogger <SingleMessageTypeListener <MyEndpointHandlingConfig, MyEvent> >();
            _spyMessageReceiver         = new SpyMessageReceiver(_options);
            _mockMessageReceiverFactory = new Mock <IMessageReceiverFactory>();
            _mockMessageReceiverFactory.Setup(m => m.CreateMessageReceiver(_options, null)).Returns(_spyMessageReceiver);
            _mockInstrumentor = new Mock <IInstrumentor>();
            _mockProcessor    = new Mock <IMessageProcessor <MyEvent> >();
            _mockProcessor.Setup(m => m.ProcessMessageAsync(It.IsAny <Message>(), _options, CancellationToken.None)).ReturnsAsync(MessageHandlingResult.Completed());

            _listener = new SingleMessageTypeListener <MyEndpointHandlingConfig, MyEvent>(
                _spyLogger,
                _mockProcessor.Object,
                _mockMessageReceiverFactory.Object,
                _mockInstrumentor.Object,
                _options);
        }