public void SaveToXmlTestStream() { AtomBase target = CreateAtomBase(); Stream stream = new MemoryStream(); target.SaveToXml(stream); Assert.IsTrue(stream.Length > 0); }
////////////////////////////////////////////////////////////////////// /// <summary>Writes a feed or entry to stdout.</summary> ////////////////////////////////////////////////////////////////////// protected void WriteToStandardOutput(AtomBase atomBase) { XmlTextWriter xmlWriter = new XmlTextWriter(Console.Out); xmlWriter.Formatting = Formatting.Indented; xmlWriter.Indentation = 2; atomBase.SaveToXml(xmlWriter); xmlWriter.Flush(); }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>dump feeds</summary> /// <param name="theOne">the filenam</param> ////////////////////////////////////////////////////////////////////// public static void DumpAtomObject(AtomBase atom, string baseName) { if (atom != null) { StreamWriter stream = new StreamWriter(baseName, false, System.Text.Encoding.UTF8); XmlTextWriter writer = new XmlTextWriter(stream); writer.Formatting = Formatting.Indented; writer.WriteStartDocument(false); atom.SaveToXml(writer); writer.Flush(); writer.Close(); stream.Close(); } }