public void Test_Construct()
 {
     //---------------Set up test pack-------------------
     //---------------Assert PreConditions---------------            
     //---------------Execute Test ----------------------
     var writer = new BusinessObjectXmlWriter();
     //---------------Test Result -----------------------
     
     //---------------Tear Down -------------------------          
 }
 public void Test_Write()
 {
     //---------------Set up test pack-------------------
     var stream = new MemoryStream();
     var xmlWriter = CreateXmlWriter(stream);
     var writer = new BusinessObjectXmlWriter();
     //---------------Assert Precondition----------------
     Assert.AreEqual(0, stream.Length);
     //---------------Execute Test ----------------------
     writer.Write(xmlWriter, new[] { new Car()});
     //---------------Test Result -----------------------
     Assert.AreNotEqual(0, stream.Length);
 }
 public void Test_Write_IncludesStartDocumentElement()
 {
     //---------------Set up test pack-------------------
     var stream = new MemoryStream();
     var xmlWriter = CreateXmlWriter(stream);
     var writer = new BusinessObjectXmlWriter();
     //---------------Assert Precondition----------------
     Assert.AreEqual(0, stream.Length);
     //---------------Execute Test ----------------------
     writer.Write(xmlWriter, new[] { new Car()});
     //---------------Test Result -----------------------
     stream.Seek(0, 0);
     var reader = new StreamReader(stream);
     var xml = reader.ReadToEnd();
     Assert.That(xml, Is.StringStarting("<?xml"));
 }
 /// <summary>
 /// Writes the businessobjects to the writer.
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="businessObjects"></param>
 /// <param name="includeStartDocument">If true, starts a new xml doc and will close the writer 
 /// after completion. If false, will act as if the write already has a doc started 
 /// (ie, won't add the startdoc element or close the writer). Defaults to true</param>
 public void Write(XmlWriter writer, IDictionary<Guid, IBusinessObject> businessObjects, bool includeStartDocument = true)
 {
     var boWriter = new BusinessObjectXmlWriter();
     boWriter.Write(writer, businessObjects.Values, includeStartDocument);
 }
Пример #5
0
        /// <summary>
        /// Writes the businessobjects to the writer.
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="businessObjects"></param>
        /// <param name="includeStartDocument">If true, starts a new xml doc and will close the writer
        /// after completion. If false, will act as if the write already has a doc started
        /// (ie, won't add the startdoc element or close the writer). Defaults to true</param>
        public void Write(XmlWriter writer, IDictionary <Guid, IBusinessObject> businessObjects, bool includeStartDocument = true)
        {
            var boWriter = new BusinessObjectXmlWriter();

            boWriter.Write(writer, businessObjects.Values, includeStartDocument);
        }