public void Initialize()
        {
            var userStorage = Substitute.For <IUserStorage>();

            _serverManager              = Substitute.For <ServerManager>(userStorage);
            _scheduler                  = Substitute.For <IScheduler>();
            _eventAggregator            = Substitute.For <IEventAggregator>();
            _mainWindowState            = Substitute.For <IMainWindowState>();
            _apiServers                 = Substitute.For <IApiServers>();
            _singleActionFactory        = Substitute.For <ISingleActionFactory>();
            _lastServerLoadTimeProvider = Substitute.For <ILastServerLoadTimeProvider>();
        }
Example #2
0
        public ServerLoadUpdater(
            TimeSpan updateInterval,
            ServerManager serverManager,
            IScheduler scheduler,
            IEventAggregator eventAggregator,
            IMainWindowState mainWindowState,
            IApiServers apiServers,
            ISingleActionFactory singleActionFactory,
            ILastServerLoadTimeProvider lastServerLoadTimeProvider)
        {
            _lastServerLoadTimeProvider = lastServerLoadTimeProvider;
            eventAggregator.Subscribe(this);

            _updateInterval  = updateInterval;
            _mainWindowState = mainWindowState;
            _serverManager   = serverManager;
            _apiServers      = apiServers;
            _timer           = scheduler.Timer();
            _timer.Interval  = updateInterval.RandomizedWithDeviation(0.2);
            _timer.Tick     += TimerOnTick;
            _updateAction    = singleActionFactory.GetSingleAction(UpdateLoads);
        }