private static void XmlNonGenericNullTest(IXmlSerializer serializer) { var type = typeof(TestModel); var xml = serializer.ToXml(type, null); var deserializeModel = serializer.FromXml(type, xml); Assert.Null(deserializeModel); }
private static void XmlGenericNullTest(IXmlSerializer serializer) { TestModel?model = null; var xml = serializer.ToXml(model); var deserializeModel = serializer.FromXml <TestModel>(xml); Assert.Null(deserializeModel); }
private static void XmlGenericTest(IXmlSerializer serializer) { var model = TestModelFactory.Create(); var xml = serializer.ToXml(model); var deserializeModel = serializer.FromXml <TestModel>(xml) !; Assert.Equal( Tuple.Create(model.Id, model.Age, model.CreateTime, model.Name, model.Gender), Tuple.Create(deserializeModel.Id, deserializeModel.Age, deserializeModel.CreateTime, deserializeModel.Name, deserializeModel.Gender)); }
public ISvgImage?Load(Stream stream) { var doc = _serializer.FromXml <SvgDocument>(stream); return(Parse(doc)); }