/// <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); }