public void ReturnsExpectedXml() { XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <class> <keyword>class</keyword> <subroutineDec> <keyword>function</keyword> </subroutineDec> </class>"); classUnderText.ConvertNode(node).Should().BeEquivalentTo(doc); }
public static void ShouldGenerateXml(this NodeBase node, string expectedXml) { var converter = new XmlConverter(); var doc = new XmlDocument(); doc.LoadXml(expectedXml); converter.ConvertNode(node).Should().BeEquivalentTo(doc); }
public static string CompilingJackCode(this VmCompiler vmCompiler, string jackCode) { using (var tokeniser = new Tokeniser(jackCode)) { var output = new StringWriter(); var writer = new VmWriter(output); var parser = new Parser(new Grammarian()); parser.Parse(tokeniser); var xmlConverter = new XmlConverter(); Console.WriteLine(xmlConverter.ConvertNode(parser.Tree).OuterXml); vmCompiler.Compile(parser.Tree, writer); return writer.ToString(); } }