public void SettingDataCollectionTest_SettingsCollectionsHaveEqualValues_2() { var mf = new MainForm(); mf.Show(); var c = new SettingDataMCollection(mf.MyDataFile); c.Add(new SettingDataM(typeof(string), "test", "val1") { }, new SettingDataM(typeof(int), "testing", 16) { }); var c2 = new SettingDataMCollection(mf.MyDataFile); c2.Add(new SettingDataM(typeof(string), "test", "val1") { }, new SettingDataM(typeof(int), "testing", 15) { }); Assert.IsFalse(SettingDataMCollection. SettingsCollectionsHaveEqualValues( c.SettingsData, c2.SettingsData)); }
public void SettingDataCollectionTest_ImportFromAttributes() { var mf = new MainForm(); mf.Show(); var c = new SettingDataMCollection(mf.MyDataFile); c.Add(new SettingDataM(typeof(Rectangle), "test", Rectangle.FromLTRB(8, 9, 100, 150)) { }, new SettingDataM(typeof(int), "int_test", 9) { }); var d = new XmlDocument(); d.AppendChild(d.CreateElement("MyRoot")); d.DocumentElement.SetAttribute("test", "5|11|100|120"); d.DocumentElement.SetAttribute("int_test", "10"); c.ImportFromAttributes(d); Assert.AreEqual(Rectangle.FromLTRB(5, 11, 100, 120), c.GetValue("test")); Assert.AreEqual(10, c.GetValue("int_test")); }
public void SettingDataCollectionTest_SetValue() { var mf = new MainForm(); mf.Show(); var c = new SettingDataMCollection(mf.MyDataFile); c.Add(new SettingDataM(typeof(string), "test", "val1") { }, new SettingDataM(typeof(int), "testing", 16) { }); c.SetValue("test", "val2"); Assert.AreEqual("val2", c.GetValue("test")); }
public void SettingDataCollectionTest_CheckIfDirtySettingExists() { var mf = new MainForm(); mf.Show(); var c = new SettingDataMCollection(mf.MyDataFile); c.Add(new SettingDataM(typeof(string), "test", "val1") { }, new SettingDataM(typeof(int), "testing", 16) { }); Assert.IsFalse(c.CheckIfDirtySettingExists()); c.SetValue("test", "val1"); Assert.IsFalse(c.CheckIfDirtySettingExists()); c.SetValue("test", "val2"); Assert.IsTrue(c.CheckIfDirtySettingExists()); }
public void SettingDataCollectionTest_ExportAsAttributes() { var mf = new MainForm(); mf.Show(); var c = new SettingDataMCollection(mf.MyDataFile); c.Add(new SettingDataM(typeof(string), "test", "val1") { }, new SettingDataM(typeof(int), "testing", 15) { }); c.SetValue("test", "val2"); var d = new XmlDocument(); var e = d.CreateElement("root"); c.ExportAsAttributes(e); Assert.AreEqual(e.GetAttribute("test"), "val2"); Assert.AreEqual(e.GetAttribute("testing"), "15"); }