static List <TestMetaData> ParseClasses(ConversionInfo conversionInfo) { var syntaxTree = CSharpSyntaxTree.ParseText(File.ReadAllText(conversionInfo.FileToConvert)); var root = syntaxTree.GetRoot(); conversionInfo.Usings = ((CompilationUnitSyntax)root).Usings.ToString(); var ns = root.ChildNodes().Single(x => x.Kind() == SyntaxKind.NamespaceDeclaration); conversionInfo.NameSpace = ((NamespaceDeclarationSyntax)ns).Name.ToString(); var classes = ns.ChildNodes().Where(x => x.Kind() == SyntaxKind.ClassDeclaration).Cast <ClassDeclarationSyntax>(); return(classes.Select(TestParser.ParseClass).ToList()); }
static void WriteTest(ConversionInfo conversionInfo) { File.WriteAllText(conversionInfo.OutputFile, conversionInfo.ToFormattedString()); }