public void Deserialize__CanDeserializeXml() { var s = new FlexiXmlSerializationService(); var xml = @"<SimpleTestStruct nameProperty=""one,two,three"" valueProperty=""13"" />"; var mtc = s.Deserialize<SimpleTestStruct>(xml); Assert.AreEqual("one,two,three", mtc.NameProperty); Assert.AreEqual(13, mtc.ValueProperty); }
public Entities.DiagnosticsConfiguration LoadConfiguration() { var doc = XDocument.Parse(configXml, LoadOptions.SetLineInfo); var serializationService = new FlexiXmlSerializationService(); serializationService.TypeLookupNamespaces.Add("SquaredInfinity.Diagnostics.ContextDataCollectors"); serializationService.TypeLookupNamespaces.Add("SquaredInfinity.Diagnostics.Entities"); serializationService.TypeLookupNamespaces.Add("SquaredInfinity.Diagnostics.Filters"); serializationService.TypeLookupNamespaces.Add("SquaredInfinity.Diagnostics.Formatters"); serializationService.TypeLookupNamespaces.Add("SquaredInfinity.Diagnostics.Sinks"); serializationService.TypeLookupNamespaces.Add("SquaredInfinity.Diagnostics.Sinks.File"); serializationService.TypeLookupNamespaces.Add("SquaredInfinity.Diagnostics.TypeDescriptors"); serializationService.KnownTypes.Add("FileSink", typeof(FileSink)); serializationService.KnownTypes.Add("SquaredInfinity.Diagnostics", typeof(DiagnosticsConfiguration)); serializationService.TryConvertStringToPropertyValue += (s, e) => TryConvertStringToPropertyValue(e); serializationService.TryResolveElementReference += (s, e) => TryResolveElementReference(e); return serializationService.Deserialize<Entities.DiagnosticsConfiguration>(doc); }