Exemple #1
0
        public async Task Detected_ShouldBe_Origin_Detected(bool value)
        {
            // Arrange
            _origin.Detected().Returns(value);
            var subject = new SafeBlockedTraffic(_origin);
            // Act
            var result = await subject.Detected();

            // Assert
            result.Should().Be(value);
        }
Exemple #2
0
        public async Task OnTimerTick_ShouldShow_BlockedTrafficModal_WhenFreeServer()
        {
            // Arrange
            _blockedTraffic.Detected().Returns(true);
            P2PDetector detector = new P2PDetector(_logger, _appConfig, _blockedTraffic, _forwardedTraffic, _scheduler, _modals, _dialogs);
            await detector.OnVpnStateChanged(new VpnStateChangedEventArgs(VpnStatus.Connected, VpnError.None, FreeServer(), false));

            // Act
            _timer.Tick += Raise.Event();
            // Assert
            _dialogs.ReceivedWithAnyArgs(1).ShowWarning("");
        }
Exemple #3
0
 private async Task CheckBlockedTraffic()
 {
     if (await _blockedTraffic.Detected())
     {
         _logger.Info("Blocked traffic detected");
         StopTimer();
         ShowBlockedTrafficModal();
     }
 }
        public async Task <bool> Detected()
        {
            try
            {
                return(await _origin.Detected());
            }
            catch (HttpRequestException)
            { }
            catch (OperationCanceledException)
            { }

            return(false);
        }