private (ExpectedExceptionRewriter, MethodDeclarationSyntax) CreateRewriterFor(string file, string methodName) { var(semantic, root) = CompiledSourceFileProvider.LoadCompilationFromFile(file); var rewriter = new ExpectedExceptionRewriter(semantic, new ExpectedExceptionMethodBodyTransformer(), new ExpectedExceptionAttributeRemover()); var method = root.DescendantNodes() .OfType <MethodDeclarationSyntax>() .Single(syntax => syntax.Identifier.ToString() == methodName); return(rewriter, method); }
private (SetUpFixtureLifeCycleRewriter, ClassDeclarationSyntax) CreateRewriterFor(string file, string className) { var(semantic, root) = CompiledSourceFileProvider.LoadCompilationFromFile(file); var rewriter = new SetUpFixtureLifeCycleRewriter( semantic, new SetUpFixtureSetUpAttributeRenamer(), new SetUpFixtureTearDownAttributeRenamer()); var method = root.DescendantNodes() .OfType <ClassDeclarationSyntax>() .Single(syntax => syntax.Identifier.ToString() == className); return(rewriter, method); }