Example #1
0
        public void test()
        {
            var folder = new DirectoryInfo(TestFileHelper.getOriginalResourcePath(""));
            var files  = folder.EnumerateFiles("*.jade", SearchOption.TopDirectoryOnly);

            JadeConfiguration jade = new JadeConfiguration();

            jade.setMode(Jade4Net.Mode.XHTML); // original jade uses xhtml by default
            jade.setFilter("plain", new PlainFilter());
            jade.setFilter("cdata", new CDATAFilter());

            foreach (var file in files)
            {
                JadeTemplate template = jade.getTemplate(file.FullName);
                TextWriter   writer   = new StringWriter();
                jade.renderTemplate(template, new Dictionary <String, Object>(), writer);
                String html = writer.ToString();

                String expected = File.ReadAllText(file.FullName.Replace(".jade", ".html"));
                // Trace.WriteLine("\n>> " + file.getName());
                // Trace.WriteLine(html);
                // Trace.WriteLine("-- " + file.getName());
                // Trace.WriteLine(expected);
                // Trace.WriteLine("<< " + file.getName());

                if (Array.IndexOf(manualCompared, file.Name.Replace(".jade", "")) >= 0)
                {
                    Assert.AreEqual(file.FullName, expected, html);
                }
            }
        }