Inheritance: ITagReader
Ejemplo n.º 1
0
    public void Constructor_allows_external_writer()
    {
      // arrange
      ITagWriter target;
      ITag expected;
      ITag actual;
      XmlWriter writer;
      TextWriter textWriter;

      expected = this.CreateComplexData();

      textWriter = new StringWriter();
      writer = XmlWriter.Create(textWriter, new XmlWriterSettings
                                            {
                                              Indent = true
                                            });

      target = new XmlTagWriter(writer);

      // act
      target.WriteTag(expected);
      writer.Flush();

      using (TextReader textReader = new StringReader(textWriter.ToString()))
      {
        using (XmlReader reader = XmlReader.Create(textReader))
        {
          actual = new XmlTagReader(reader).ReadTag();
        }
      }

      // assert
      this.CompareTags(expected, actual);
    }
Ejemplo n.º 2
0
    public void LoadTest()
    {
      // arrange
      ITagReader target;
      TagCompound expected;
      TagCompound actual;

      expected = this.CreateComplexData();
      target = new XmlTagReader();

      // act
      using (Stream stream = File.OpenRead(this.ComplexXmlDataFileName))
      {
        actual = target.ReadDocument(stream);
      }

      // assert
      this.CompareTags(expected, actual);
    }
Ejemplo n.º 3
0
    public void ReadDocument_can_handle_xml_documents_with_self_closing_tags()
    {
      // arrange
      XmlTagReader target;
      ITag actual;
      ITag expected;

      target = new XmlTagReader();

      expected = this.CreateSimpleNesting();

      // act
      using (Stream stream = File.OpenRead(Path.Combine(this.DataPath, "project.xml")))
      {
        actual = target.ReadDocument(stream);
      }

      // assert
      this.CompareTags(expected, actual);
    }
Ejemplo n.º 4
0
    public void Constructor_allows_external_reader()
    {
      // arrange
      ITagReader target;
      ITag expected;
      ITag actual;
      XmlReader reader;

      expected = this.CreateComplexData();

      reader = XmlReader.Create(this.ComplexXmlDataFileName);

      target = new XmlTagReader(reader);

      // act
      actual = target.ReadTag();

      // assert
      this.CompareTags(expected, actual);
    }
Ejemplo n.º 5
0
    public void ReadDocument_can_handle_xml_documents_without_whitespace()
    {
      // arrange
      ITagReader target;
      TagCompound expected;
      TagCompound actual;

      expected = this.CreateComplexData();
      target = new XmlTagReader();

      // act
      using (Stream stream = File.OpenRead(this.ComplexXmlWithoutWhitespaceDataFileName))
      {
        actual = target.ReadDocument(stream);
      }

      // assert
      this.CompareTags(expected, actual);
    }