コード例 #1
0
        void RunTest(string c_code, string expectedXml)
        {
            StringReader reader = null;
            StringWriter writer = null;

            try
            {
                reader = new StringReader(c_code);
                writer = new StringWriter();
                var xWriter = new XmlnsHidingWriter(writer)
                {
                    Formatting = Formatting.Indented
                };
                var xc = new XmlConverter(reader, xWriter);
                xc.Convert();
                writer.Flush();
                Assert.AreEqual(expectedXml, writer.ToString());
            }
            catch
            {
                Debug.WriteLine(writer.ToString());
                throw;
            }
            finally
            {
                if (writer != null)
                {
                    writer.Dispose();
                }
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }
コード例 #2
0
ファイル: XmlConverterTests.cs プロジェクト: gh0std4ncer/reko
 void RunTest(string c_code, string expectedXml)
 {
     StringReader reader = null;
     StringWriter writer = null;
     try
     {
         reader = new StringReader(c_code);
         writer = new StringWriter();
         var xWriter = new XmlnsHidingWriter(writer)
         {
             Formatting = Formatting.Indented
         };
         var xc = new XmlConverter(reader, xWriter);
         xc.Convert();
         writer.Flush();
         Assert.AreEqual(expectedXml, writer.ToString());
     }
     catch
     {
         Debug.WriteLine(writer.ToString());
         throw;
     }
     finally
     {
         if (writer != null)
             writer.Dispose();
         if (reader != null)
             reader.Dispose();
     }
 }
コード例 #3
0
        void RunTest(string c_code, string expectedXml, string dialect)
        {
            StringReader reader = null;
            StringWriter writer = null;

            try
            {
                reader = new StringReader(c_code);
                writer = new StringWriter();
                //var xWriter = new XmlTextWriter(writer)
                var xWriter = new XmlnsHidingWriter(writer)
                {
                    Formatting = Formatting.Indented
                };
                var arch     = new FakeArchitecture(new ServiceContainer());
                var platform = new DefaultPlatform(null, arch);
                var xc       = new XmlConverter(reader, xWriter, platform, true, dialect);
                xc.Convert();
                writer.Flush();
                Assert.AreEqual(expectedXml, writer.ToString());
            }
            catch
            {
                Debug.WriteLine(writer.ToString());
                throw;
            }
            finally
            {
                if (writer != null)
                {
                    writer.Dispose();
                }
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }