/// <summary>
        /// Constructor for <see cref="DefaultStatisticsCompressorService"/>.
        /// </summary>
        /// <param name="dataService">Data service.</param>
        /// <param name="timeService">Component for getting current time.</param>
        /// <param name="logger">Component for logging.</param>
        public DefaultStatisticsCompressorService(IDataService dataService, IStatisticsTimeService timeService, ILogger logger, IStatisticsService statisticsService)
        {
            if (dataService == null)
            {
                throw new ArgumentNullException(nameof(dataService));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (timeService == null)
            {
                throw new ArgumentNullException(nameof(timeService));
            }

            if (statisticsService == null)
            {
                throw new ArgumentNullException(nameof(statisticsService));
            }

            _dataService       = dataService;
            _logger            = logger;
            _timeService       = timeService;
            _periodicalTimer   = new PeriodicalTimer();
            _statisticsService = statisticsService;
        }
示例#2
0
        /// <summary>
        /// Constructor for <see cref="DefaultStatisticsService"/>.
        /// </summary>
        /// <param name="statSettings">Component for getting statistics settings.</param>
        /// <param name="saveService">Component for saving statistics.</param>
        /// <param name="timeService">Component for getting current time.</param>
        /// <param name="subscriptions">Subscriptions manager.</param>
        /// <param name="logger">Component for logging.</param>
        public DefaultStatisticsService(IStatisticsSettings statSettings, IStatisticsSaveService saveService, IStatisticsTimeService timeService, ISubscriptionsManager subscriptions, ILogger logger)
        {
            if (statSettings == null)
            {
                throw new ArgumentNullException(nameof(statSettings));
            }

            if (saveService == null)
            {
                throw new ArgumentNullException(nameof(saveService));
            }

            if (timeService == null)
            {
                throw new ArgumentNullException(nameof(timeService));
            }

            if (subscriptions == null)
            {
                throw new ArgumentNullException(nameof(subscriptions));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _statSettings  = statSettings;
            _saveService   = saveService;
            _timeService   = timeService;
            _subscriptions = subscriptions;
            _logger        = logger;

            _periodicalTimer = new PeriodicalTimer();
        }
        public void TestConstructorMissingParameters(IStatisticsSettings statSettings, IStatisticsSaveService saveService, IStatisticsTimeService timeService, ISubscriptionsManager subscriptions, ILogger logger)
        {
            // Arrange.
            bool check = false;

            // Act.
            try
            {
                var service = new DefaultStatisticsService(statSettings, saveService, timeService, subscriptions, logger);
            }
            catch (ArgumentNullException)
            {
                check = true;
            }

            // Assert.
            Assert.True(check);
        }