public void TestUserSettingsSection() { UserSettingsSubSection section = new UserSettingsSubSection(); section.Name = "a"; Assert.AreEqual("a", section.Name); Assert.IsNotNull(section.Settings); Assert.IsNull(section["a"]); section["a"] = "b"; Assert.AreEqual("b", section["a"]); section["a"] = "c"; Assert.AreEqual("c", section["a"]); UserSettingsSubSection section2 = new UserSettingsSubSection(); section2.Name = "b"; Assert.AreNotEqual(0, section.CompareTo(section2)); section2.Name = "a"; Assert.AreEqual(0, section.CompareTo(section2)); section["a"] = "b"; section.Settings.Add("hello", "world"); section2.Settings.Add("hello", "universe"); Assert.AreEqual("universe", section2["hello"]); section2.CopyFrom(section); Assert.AreEqual("b", section2["a"]); Assert.AreEqual("world", section2["hello"]); }
/// <summary> creates a new UserSettingsSubSection </summary> protected override ConfigurationElement CreateNewElement(string elementName) { UserSettingsSubSection secton = new UserSettingsSubSection(); secton.Name = elementName; return secton; }