public void Test_02_SaveToRegistry() { Test_Helper.SetValuesInRegistry("", 0, "", "", ""); LdapServerInformation cut = new LdapServerInformation(); cut.ServerName = "testServer"; cut.Port = 3; cut.Context = "testContext"; cut.UserName = "******"; cut.Password = "******"; cut.KeyString = LdapServerInformation.DEFAULTREGKEY; Assert.IsTrue(cut.SaveToRegistry()); ServerInfo confirm = Test_Helper.GetValuesFromRegistry(); Assert.AreEqual("testServer", confirm.ServerName); Assert.AreEqual(3, confirm.Port); Assert.AreEqual("testContext", confirm.Context); Assert.AreEqual("testUser", confirm.UserName); Assert.AreEqual("testPassword", confirm.Password); }
private void CreateNewServer() { LdapServerInformation ls = new LdapServerInformation(); ServerEditor setupDlg = new ServerEditor(ls); if (setupDlg.ShowDialog() == DialogResult.OK) { ls.SaveToRegistry(); // Add the new analyzer to the analyzer list DirectoryAnalyzer newAnalyzer = new DirectoryAnalyzer(ls); DirectoryAnalyzers.Instance.Add(newAnalyzer); // Add the new analyzer to the combo box, and select it ldapServerCombo.Items.Insert(0, newAnalyzer); ldapServerCombo.SelectedIndex = 0; } }