Esempio n. 1
0
        public void SaveManyCredentials()
        {
            var fn = FileUtility.GetTempFileName(".txt");

            TextFileCredentials c = new TextFileCredentials(fn);

            for (int i = 0; i < 30; i++)
            {
                var pw  = "a".PadRight(i + 1, 'B');
                var svr = "server" + i;
                Logger.WriteLine(svr);
                Logger.WriteLine(pw);
                c.Save(svr, pw);
                Logger.WriteLine(c.GetPassword(svr));
            }

            for (int i = 0; i < 30; i++)
            {
                Assert.IsTrue(c.Contains("server" + 1));

                var pw  = "a".PadRight(i + 1, 'B');
                var svr = c.GetPassword("server" + i);
                Assert.AreEqual(svr, pw);
            }
        }
Esempio n. 2
0
        private void save_Click(object sender, EventArgs e)
        {
            if (!dbList.Contains(this.comboBox1.Text))
            {
                string val = comboBox1.Text;
                if (this.comboBox1.SelectedItem != null)
                {
                    val = comboBox1.Text;
                }
                dbList.Insert(0, val);
                Properties.Settings.Default.Save();
            }

            credentials.Save(comboBox1.Text.Trim(), textBoxPassword.Text);
        }