public void SetUp()
        {
            hkcu.DeleteSubKeyTree(TestKeyPath, false);
            var baseKey = hkcu.CreateSubKey(TestKeyPath);

            this.settingsRepository = new SshSettingsRepository(baseKey);
        }
        public void WhenKeyEmpty_ThenDefaultsAreProvided()
        {
            var baseKey    = hkcu.CreateSubKey(TestKeyPath);
            var repository = new SshSettingsRepository(baseKey);

            var settings = repository.GetSettings();

            Assert.IsTrue(settings.IsPropagateLocaleEnabled.BoolValue);
            Assert.AreEqual(60 * 60 * 24 * 30, settings.PublicKeyValidity.IntValue);
        }
 public SshConnectionService(IServiceProvider serviceProvider)
 {
     this.jobService            = serviceProvider.GetService <IJobService>();
     this.sessionBroker         = serviceProvider.GetService <ISshTerminalSessionBroker>();
     this.tunnelBroker          = serviceProvider.GetService <ITunnelBrokerService>();
     this.settingsService       = serviceProvider.GetService <IConnectionSettingsService>();
     this.authorizedKeyService  = serviceProvider.GetService <IAuthorizedKeyService>();
     this.keyStoreAdapter       = serviceProvider.GetService <IKeyStoreAdapter>();
     this.authorizationAdapter  = serviceProvider.GetService <IAuthorizationAdapter>();
     this.sshSettingsRepository = serviceProvider.GetService <SshSettingsRepository>();
     this.window = serviceProvider.GetService <IMainForm>().Window;
 }
        public SshOptionsViewModel(
            SshSettingsRepository settingsRepository)
        {
            this.settingsRepository = settingsRepository;

            //
            // Read current settings.
            //
            // NB. Do not hold on to the settings object because other tabs
            // might apply changes to other application settings.
            //
            var settings = this.settingsRepository.GetSettings();

            this.IsPropagateLocaleEnabled =
                settings.IsPropagateLocaleEnabled.BoolValue;
            this.PublicKeyValidityInDays =
                (int)TimeSpan.FromSeconds(settings.PublicKeyValidity.IntValue).TotalDays;

            this.isDirty = false;
        }