public string GenerateTest(SyntaxTree tree, string name) { IndentingWriter = IndentingTextWriter.Get(new StringWriter()); sb = new StringBuilder(); sb.AppendLine(); sb.AppendLine("using LanguageModel.Tests.TestGeneration;"); sb.AppendLine("using LanguageService;"); sb.AppendLine("using Xunit;"); sb.AppendLine("namespace LanguageModel.Tests.GeneratedTestFiles"); sb.AppendLine("{"); sb.AppendLine(string.Format(" class {0}", name)); sb.AppendLine(" {"); sb.AppendLine(" [Fact]"); sb.AppendLine(" public void Test(Tester t)"); sb.AppendLine(" {"); using (IndentingWriter.Indent()) { using (IndentingWriter.Indent()) { using (IndentingWriter.Indent()) { GenerateTestStructure(tree.Root); } } } sb.Append(IndentingWriter.ToString()); sb.AppendLine(" }"); sb.AppendLine(" }"); sb.AppendLine("}"); return sb.ToString(); }
public Tester(SyntaxTree actualTree) { this.treeEnumerator = actualTree.Root.Descendants().GetEnumerator(); }