void Test_XmlImport() { var frame = new EmberSequence(new BerTag(BerClass.Application, 1)); var appDefined1 = EmberApplicationInterface.CreateApplicationDefinedSet(new BerTag(BerClass.ContextSpecific, 444), 1, frame); var appDefined2 = EmberApplicationInterface.CreateApplicationDefinedSequence(new BerTag(BerClass.ContextSpecific, 445), 2, appDefined1); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 1), -1); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 2), true); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 3), false); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 4), 12345.6789); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 5), "wasgehtäb?"); Console.WriteLine("\r\n------------------------ XML Import"); var xml1 = GetXml(frame); using (var stream = new StringReader(xml1)) using (var reader = new XmlTextReader(stream)) { var root = XmlImport.Import(reader, this); var xml2 = GetXml(root); Console.WriteLine(xml2); Debug.Assert(xml1 == xml2); } }
void Test_XmlImport() { var frame = new EmberSequence(new BerTag(BerClass.Application, 1)); var appDefined1 = EmberApplicationInterface.CreateApplicationDefinedSet(new BerTag(BerClass.ContextSpecific, 444), 1, frame); var appDefined2 = EmberApplicationInterface.CreateApplicationDefinedSequence(new BerTag(BerClass.ContextSpecific, 445), 2, appDefined1); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 1), -1); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 2), true); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 3), false); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 4), 12345.6789); appDefined2.Insert(new BerTag(BerClass.ContextSpecific, 5), "wasgehtäb?"); Console.WriteLine("\r\n------------------------ XML Import"); DumpXml(frame); var buffer = new StringBuilder(); using (var writer = XmlWriter.Create(buffer)) XmlExport.Export(frame, writer); using (var stream = new StringReader(buffer.ToString())) using (var reader = new XmlTextReader(stream)) { var root = XmlImport.Import(reader, this); DumpXml(root); } }