public MessageDispatcher(
     INodeIdProvider nodeIdProvider,
     IMessageSenderProvider messageSenderProvider,
     IServiceBusListener serviceBusListener,
     ILogger <MessageDispatcher> logger)
 {
     _nodeIdProvider        = nodeIdProvider;
     _messageSenderProvider = messageSenderProvider;
     _serviceBusListener    = serviceBusListener;
     _logger = logger;
 }
        public MessageDispatcherTests()
        {
            _nodeIdProvider        = A.Fake <INodeIdProvider>();
            _messageSenderProvider = A.Fake <IMessageSenderProvider>();
            _listener      = A.Fake <IServiceBusListener>();
            _logger        = A.Fake <ILogger <MessageDispatcher> >();
            _messageSender = A.Fake <IMessageSender>();

            A.CallTo(() => _nodeIdProvider.NodeId).Returns(Guid.NewGuid());

            A.CallTo(() => _messageSenderProvider.GetMessageSenderForHub(A <string> ._)).Returns(_messageSender);

            A.CallTo(() => _listener.StartListeningAsync(A <MessageHandler> ._, A <CancellationToken> ._))
            .Invokes((MessageHandler mh, CancellationToken _) => _messageHandler = mh);

            _dispatcher = new MessageDispatcher(_nodeIdProvider, _messageSenderProvider, _listener, _logger);
        }
 public ScraperRunnerHostedService(IQueueClient queueClient, IServiceBusListener serviceBusListener, ILoggerFactory loggerFactory)
 {
     _queueClient        = queueClient;
     _serviceBusListener = serviceBusListener;
     _logger             = loggerFactory.CreateLogger <ScraperRunnerHostedService>();
 }