Example #1
0
        public void Init()
        {
            _cts           = new CancellationTokenSource(TimeSpan.FromSeconds(15));
            _loggerFactory = Substitute.For <ILoggerFactory>();
            _logger        = Substitute.For <ILogger <QuidjiboServer> >();
            _loggerFactory.CreateLogger <QuidjiboServer>().Returns(_logger);

            _quidjiboConfiguration = Substitute.For <IQuidjiboConfiguration>();

            _workProviderFactory = Substitute.For <IWorkProviderFactory>();
            _workProvider        = Substitute.For <IWorkProvider>();
            _workProviderFactory.CreateAsync(Arg.Any <string>(), Arg.Any <CancellationToken>()).Returns(Task.FromResult(_workProvider));
            _workProviderFactory.PollingInterval.Returns(1);

            _scheduleProviderFactory = Substitute.For <IScheduleProviderFactory>();
            _scheduleProvider        = Substitute.For <IScheduleProvider>();
            _scheduleProviderFactory.CreateAsync(Arg.Any <string[]>(), Arg.Any <CancellationToken>()).Returns(Task.FromResult(_scheduleProvider));
            _scheduleProviderFactory.PollingInterval.Returns(1);

            _progressProviderFactory = Substitute.For <IProgressProviderFactory>();
            _progressProvider        = Substitute.For <IProgressProvider>();
            _progressProviderFactory.CreateAsync(Arg.Any <string[]>(), Arg.Any <CancellationToken>()).Returns(Task.FromResult(_progressProvider));

            Substitute.For <IWorkDispatcher>();
            Substitute.For <IPayloadSerializer>();
            _cronProvider = Substitute.For <ICronProvider>();
            _pipeline     = Substitute.For <IQuidjiboPipeline>();


            _sut = new QuidjiboServer(_loggerFactory, _quidjiboConfiguration, _workProviderFactory, _scheduleProviderFactory, _progressProviderFactory, _cronProvider, _pipeline);
        }
Example #2
0
 public QuidjiboServer(
     ILoggerFactory loggerFactory,
     IQuidjiboConfiguration quidjiboConfiguration,
     IWorkProviderFactory workProviderFactory,
     IScheduleProviderFactory scheduleProviderFactory,
     IProgressProviderFactory progressProviderFactory,
     ICronProvider cronProvider,
     IQuidjiboPipeline quidjiboPipeline)
 {
     _logger = loggerFactory.CreateLogger <QuidjiboServer>();
     _workProviderFactory     = workProviderFactory;
     _scheduleProviderFactory = scheduleProviderFactory;
     _quidjiboConfiguration   = quidjiboConfiguration;
     _cronProvider            = cronProvider;
     _quidjiboPipeline        = quidjiboPipeline;
     _progressProviderFactory = progressProviderFactory;
     Worker = $"{Environment.GetEnvironmentVariable("COMPUTERNAME")}-{Guid.NewGuid()}";
 }