Пример #1
0
        public void Roundtrip()
        {
            var yaml = GetDocument("test10.yaml");

            var converter = new XmlConverter();
            var xml = converter.ToXml(yaml);

            var firstBuffer = new StringWriter();
            xml.Save(firstBuffer);
            Dump.Write(firstBuffer);

            var intermediate = converter.FromXml(xml);
            var final = converter.ToXml(intermediate);

            var secondBuffer = new StringWriter();
            final.Save(secondBuffer);
            Dump.Write(secondBuffer);

            Assert.Equal(firstBuffer.ToString(), secondBuffer.ToString());
        }
Пример #2
0
        public void Roundtrip()
        {
            YamlDocument yaml = GetDocument("test10.yaml");

            XmlConverter converter = new XmlConverter();
            XmlDocument xml = converter.ToXml(yaml);

            StringWriter firstBuffer = new StringWriter();
            xml.Save(firstBuffer);
            Console.Out.Write(firstBuffer.ToString());

            YamlDocument intermediate = converter.FromXml(xml);
            XmlDocument final = converter.ToXml(intermediate);

            StringWriter secondBuffer = new StringWriter();
            final.Save(secondBuffer);
            Console.Error.Write(secondBuffer.ToString());

            Assert.AreEqual(firstBuffer.ToString(), secondBuffer.ToString(), "The first and second XML are different.");
        }