public RequestHandlerTests()
 {
     _messageBroker       = Substitute.For <IMessageBroker>();
     _queueHandlerFactory = Substitute.For <IQueueHandlerFactory>();
     _queueNameUtility    = Substitute.For <IQueueNameUtility>();
     _cancellationToken   = new CancellationToken();
 }
 public MessageBusTests()
 {
     _messageBroker       = Substitute.For <IMessageBroker>();
     _cancellationToken   = new CancellationToken();
     _queueHandlerFactory = Substitute.For <IQueueHandlerFactory>();
     _queueHandler        = Substitute.For <IQueueHandler>();
     _queueNameUtility    = Substitute.For <IQueueNameUtility>();
     _queueHandlerFactory.Create().Returns(_queueHandler);
 }
Exemple #3
0
 /// <inheritdoc />
 public MessageBroker(ILogger logger, MessageBusConfig messageBusConfig, IQueueFactory queueFactory, IProcessInformation processInformation, IQueueNameUtility queueNameUtility)
 {
     _logger             = logger;
     _messageBusConfig   = messageBusConfig;
     _queueFactory       = queueFactory;
     _processInformation = processInformation;
     _queueNameUtility   = queueNameUtility;
     _messageBrokerQueue = _queueFactory.CreateLocale(MessageBrokerConfig.LocaleQueueName, true, LocaleQueueMode.Durable, true, AccessMode.Send);
 }
        /// <inheritdoc />
        public MessageBus(ILogger logger, IMessageBroker messageBroker, IQueueHandlerFactory queueHandlerFactory, IQueueNameUtility queueNameUtility)
        {
            _messageBroker       = messageBroker;
            _queueHandlerFactory = queueHandlerFactory;
            _queueNameUtility    = queueNameUtility;
            _logger = logger;

            _subscribeHandlers = new List <SubscribeHandler>();
            _requestHandlers   = new List <RequestHandler>();
        }
Exemple #5
0
        public MessageBrokerTests()
        {
            _messageBusConfig = new MessageBusConfig
            {
                ServiceName = "MessageBrokerTests"
            };

            _queueFactory       = Substitute.For <IQueueFactory>();
            _queueNameUtility   = new QueueNameUtility("UniTests");
            _processInformation = Substitute.For <IProcessInformation>();
            _processInformation.MachineName.Returns("TestServer");

            _cancellationToken = new CancellationToken();

            _messageBrokerQueue = Substitute.For <ILocaleQueue>();
            _messageBrokerQueue.Exists().Returns(true);
            _queueFactory.CreateLocale(MessageBrokerConfig.LocaleQueueName, Arg.Any <bool>(), Arg.Any <LocaleQueueMode>(), Arg.Any <bool>(), Arg.Any <AccessMode>()).Returns(_messageBrokerQueue);
        }
Exemple #6
0
 /// <inheritdoc />
 public RequestHandler(ILogger logger, IMessageBroker messageBroker, IQueueHandlerFactory queueHandlerFactory, string name, IQueueNameUtility queueNameUtility)
 {
     _logger              = logger;
     _messageBroker       = messageBroker;
     _queueHandlerFactory = queueHandlerFactory;
     Name      = name;
     QueueName = queueNameUtility.Build(Name);
 }
 /// <inheritdoc />
 public SubscribeHandler(ILogger logger, IMessageBroker messageBroker, IQueueHandlerFactory queueHandlerFactory, string name, string topic, bool durable, IQueueNameUtility queueNameUtility)
 {
     _logger              = logger;
     _messageBroker       = messageBroker;
     _queueHandlerFactory = queueHandlerFactory;
     Name      = name;
     Topic     = topic;
     Durable   = durable;
     QueueName = queueNameUtility.Build(Topic, Name, Durable);
 }