public void SaveConfiguration(ConfigurationItem configItem) { configItem.AssertNotNull(nameof(configItem)); CreateConfigFileIfNecessary(); string xml = QuickXmlSerializer.SerializeObject(configItem); File.WriteAllText(ConfigFilePath, xml); }
public void TestQuickXmlSerializerDynamic() { QuickXmlSerializerTestClass testObj = new QuickXmlSerializerTestClass { Value = "lol", Number = 1 }; string xml = QuickXmlSerializer.SerializeObject(testObj); Assert.IsNotNull(xml); IDictionary <string, object> deserializedObj = QuickXmlSerializer.GetDynamicObjectFromXml(xml); Assert.IsTrue(deserializedObj.ContainsKey("QuickXmlSerializerTestClass")); }
public void TestQuickXmlSerializer() { QuickXmlSerializerTestClass testObj = new QuickXmlSerializerTestClass { Value = "lol", Number = 1 }; string xml = QuickXmlSerializer.SerializeObject(testObj); Assert.IsNotNull(xml); QuickXmlSerializerTestClass deserializedObj = QuickXmlSerializer.DeserializeObject <QuickXmlSerializerTestClass>(xml); Assert.AreEqual(testObj, deserializedObj); }