Пример #1
0
        public void ToVersion_ShouldBe_1_8_0()
        {
            // Arrange
            var migration = new AppSettingsMigration(_storage);
            // Act
            var result = migration.ToVersion;

            // Assert
            result.Should().Be(new Version(1, 8, 0));
        }
Пример #2
0
        public void Apply_ShouldSet_OvpnProtocol_ToAuto(string previousValue)
        {
            // Arrange
            _storage.Get <string>("OvpnProtocol").Returns(previousValue);
            var migration = new AppSettingsMigration(_storage);

            // Act
            migration.Apply();
            // Assert
            _storage.Received().Set("OvpnProtocol", "auto");
        }
Пример #3
0
        public void Apply_Should_NotSwitchOff_SplitTunnel_WhenKillSwitch_IsOff()
        {
            // Arrange
            _storage.Get <bool>("KillSwitch").Returns(false);
            _storage.Get <bool>("SplitTunnelingEnabled").Returns(true);
            var migration = new AppSettingsMigration(_storage);

            // Act
            migration.Apply();
            // Assert
            _storage.DidNotReceive().Set("SplitTunnelingEnabled", Arg.Any <bool>());
        }
Пример #4
0
        public void Apply_Should_NotApplyMigration_OvpnProtocol_WhenUserSettingsVersion_Contains_1_10(bool migrated, string userSettingsVersion)
        {
            // Arrange
            _storage.Get <string>("UserSettingsVersion").Returns(userSettingsVersion);
            _storage.Get <string>("OvpnProtocol").Returns("udp");
            var migration = new AppSettingsMigration(_storage);

            // Act
            migration.Apply();
            // Assert
            if (migrated)
            {
                _storage.Received().Set("OvpnProtocol", "auto");
            }
            else
            {
                _storage.DidNotReceive().Set("OvpnProtocol", Arg.Any <string>());
            }
        }