Exemplo n.º 1
0
 public P2PDetector(
     ILogger logger,
     Common.Configuration.Config appConfig,
     IBlockedTraffic blockedTraffic,
     IForwardedTraffic forwardedTraffic,
     IScheduler scheduler,
     IModals modals,
     IDialogs dialogs) :
     this(logger, blockedTraffic, forwardedTraffic, scheduler.Timer(), modals, dialogs, appConfig.P2PCheckInterval.RandomizedWithDeviation(0.2))
 {
 }
Exemplo n.º 2
0
        public void TestInitialize()
        {
            _logger           = Substitute.For <ILogger>();
            _appConfig        = new Common.Configuration.Config();
            _blockedTraffic   = Substitute.For <IBlockedTraffic>();
            _forwardedTraffic = Substitute.For <IForwardedTraffic>();
            _scheduler        = Substitute.For <IScheduler>();
            _modals           = Substitute.For <IModals>();
            _dialogs          = Substitute.For <IDialogs>();

            _timer = Substitute.For <ISchedulerTimer>();
            _timer.When(x => x.Start()).Do(x => _timerIsEnabled = true);
            _timer.When(x => x.Stop()).Do(x => _timerIsEnabled  = false);
            _timer.When(x => x.IsEnabled = Arg.Do <bool>(value => _timerIsEnabled = value));
            _timer.IsEnabled.Returns(_ => _timerIsEnabled);
            _scheduler.Timer().Returns(_timer);
        }
Exemplo n.º 3
0
        private P2PDetector(
            ILogger logger,
            IBlockedTraffic blockedTraffic,
            IForwardedTraffic forwardedTraffic,
            ISchedulerTimer timer,
            IModals modals,
            IDialogs dialogs,
            TimeSpan checkInterval)
        {
            _logger           = logger;
            _blockedTraffic   = blockedTraffic;
            _forwardedTraffic = forwardedTraffic;
            _timer            = timer;
            _modals           = modals;
            _dialogs          = dialogs;

            _timer.Interval = checkInterval;
            _timer.Tick    += OnTimerTick;
        }