Ejemplo n.º 1
0
        public void ExpectedLeakProtectionStatus_ShouldBe_Firewall_LeakProtectionEnabled_WhenOtherStatus(VpnStatus status, bool leakProtectionEnabled)
        {
            // Arrange
            var state = new VpnState(status);

            _firewall.LeakProtectionEnabled.Returns(leakProtectionEnabled);
            var killSwitch = new Service.KillSwitch.KillSwitch(_firewall, _serviceSettings);

            // Act
            var result = killSwitch.ExpectedLeakProtectionStatus(state);

            //Assert
            result.Should().Be(leakProtectionEnabled);
        }
Ejemplo n.º 2
0
        public void ExpectedLeakProtectionStatus_ShouldBe_Firewall_LeakProtectionEnabled_WhenOtherStatus(
            VpnStatus status, bool leakProtectionEnabled)
        {
            // Arrange
            var state = new VpnState(status, default);

            _firewall.LeakProtectionEnabled.Returns(leakProtectionEnabled);
            Service.KillSwitch.KillSwitch killSwitch =
                new Service.KillSwitch.KillSwitch(_firewall, _serviceSettings, _networkInterfaceLoader);

            // Act
            bool result = killSwitch.ExpectedLeakProtectionStatus(state);

            //Assert
            result.Should().Be(leakProtectionEnabled);
        }
Ejemplo n.º 3
0
        public void ExpectedLeakProtectionStatus_ShouldBe_Expected_WhenDisconnecting(VpnStatus status, VpnError error,
                                                                                     KillSwitchMode killSwitchMode, bool leakProtectionEnabled, bool expected)
        {
            // Arrange
            var state = new VpnState(status, error, default);

            _serviceSettings.KillSwitchMode.Returns(killSwitchMode);
            _firewall.LeakProtectionEnabled.Returns(leakProtectionEnabled);
            Service.KillSwitch.KillSwitch killSwitch =
                new Service.KillSwitch.KillSwitch(_firewall, _serviceSettings, _networkInterfaceLoader);

            // Act
            bool result = killSwitch.ExpectedLeakProtectionStatus(state);

            //Assert
            result.Should().Be(expected);
        }
Ejemplo n.º 4
0
        public void ExpectedLeakProtectionStatus_ShouldBe_Expected_WhenConnecting(VpnStatus status, SplitTunnelMode splitTunnelMode, bool expected)
        {
            // Arrange
            var state = new VpnState(status);

            _serviceSettings.SplitTunnelSettings.Returns(new SplitTunnelSettingsContract
            {
                Mode = splitTunnelMode
            });
            var killSwitch = new Service.KillSwitch.KillSwitch(_firewall, _serviceSettings);

            // Act
            var result = killSwitch.ExpectedLeakProtectionStatus(state);

            //Assert
            result.Should().Be(expected);
        }
Ejemplo n.º 5
0
        public void ExpectedLeakProtectionStatus_ShouldBe_Enabled_WhenConnecting(VpnStatus status)
        {
            // Arrange
            var state = new VpnState(status, default);

            _serviceSettings.SplitTunnelSettings.Returns(new SplitTunnelSettingsContract
            {
                Mode = SplitTunnelMode.Block
            });
            Service.KillSwitch.KillSwitch killSwitch =
                new Service.KillSwitch.KillSwitch(_firewall, _serviceSettings, _networkInterfaceLoader);

            // Act
            bool result = killSwitch.ExpectedLeakProtectionStatus(state);

            //Assert
            result.Should().Be(true);
        }
Ejemplo n.º 6
0
        public void ExpectedLeakProtectionStatus_ShouldBe_Expected_WhenDisconnecting(VpnStatus status, VpnError error, bool killSwitchEnabled, bool leakProtectionEnabled, bool expected)
        {
            // Arrange
            var state = new VpnState(status, error);

            _serviceSettings.KillSwitchSettings.Returns(new KillSwitchSettingsContract
            {
                Enabled = killSwitchEnabled
            });
            _firewall.LeakProtectionEnabled.Returns(leakProtectionEnabled);
            var killSwitch = new Service.KillSwitch.KillSwitch(_firewall, _serviceSettings);

            // Act
            var result = killSwitch.ExpectedLeakProtectionStatus(state);

            //Assert
            result.Should().Be(expected);
        }