public void CanGetSetProperties()
        {
            var entity = new AcmeSettings();

            entity.VerifyGetterSetter(a => a.Key, Encoding.UTF8.GetBytes("certes"));
            entity.VerifyGetterSetter(a => a.ServerUri, new Uri("http://certes.is.working"));
        }
Esempio n. 2
0
        public async Task SetAccountKey(Uri serverUri, IKey key)
        {
            var settings = await LoadUserSettings();
            if (settings.Servers == null)
            {
                settings.Servers = new AcmeSettings[0];
            }

            var servers = settings.Servers.ToList();
            var serverSetting = servers.FirstOrDefault(s => s.ServerUri == serverUri);
            if (serverSetting == null)
            {
                servers.Add(serverSetting = new AcmeSettings { ServerUri = serverUri });
            }

            serverSetting.Key = key.ToDer();
            settings.Servers = servers;
            var json = JsonConvert.SerializeObject(settings, JsonUtil.CreateSettings());
            await fileUtil.WriteAllText(settingsFilepath.Value, json);
        }