XmlFileTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Content.Xml.Tests XmlFileTests

Namespace: DeltaEngine.Content.Xml.Tests
Assembly: DeltaEngine.Content.Xml.Tests (in DeltaEngine.Content.Xml.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class XmlFileTests

The XmlFileTests type exposes the following members.

Constructors

  NameDescription
Public methodXmlFileTests
Initializes a new instance of the XmlFileTests class
Top
Methods

  NameDescription
Public methodLoadXmlFromStream
Public methodSavingAndLoadingLeavesItUnchanged
Public methodXmlDataConstructor
Top
Examples

[Test]
public void XmlDataConstructor()
{
    var data = new XmlData("name");
    var file = new XmlFile(data);
    Assert.AreEqual(data, file.Root);
}
[Test]
public void LoadXmlFromStream()
{
    var memoryStream = new MemoryStream();
    var writer = new BinaryWriter(memoryStream);
    writer.Write(new XmlData("MyData").ToString());
    memoryStream.Seek(0, SeekOrigin.Begin);
    var file = new XmlFile(memoryStream);
    Assert.AreEqual("MyData", file.Root.Name);
}
[Test]
public void SavingAndLoadingLeavesItUnchanged()
{
    XmlData data = CreateTestXmlData();
    var file = new XmlFile(data);
    file.Save("file.xml");
    XmlData loaded = new XmlFile("file.xml").Root;
    Assert.AreEqual(data.ToString(), loaded.ToString());
}
See Also