Exemple #1
0
 public static void Verify <TInput, TOutput>(
     TryGetAction3 <TInput> tryGetAction,
     string expected,
     string code
     )
     where TInput : StatementSyntax
     where TOutput : StatementSyntax
 {
     Verify(
         tryGetAction.AsTransformer(),
         root => FindFixture <TInput>(root),
         root => FindFixture <TOutput>(root),
         expected,
         code
         );
 }
Exemple #2
0
        public static StatementTransformer <TStatement> AsTransformer <TStatement>(
            this TryGetAction3 <TStatement> tryGetAction
            )
            where TStatement : StatementSyntax
        {
            return((inputStatement, root, semanticModel) =>
            {
                Func <SyntaxNode, SyntaxNode> action;

                if (!tryGetAction(inputStatement, out action))
                {
                    return root;
                }

                return action(root);
            });
        }
Exemple #3
0
        public static void VerifyDeclaration <TStatement>(
            TryGetAction3 <TStatement> tryGetAction,
            string expected,
            string code,
            string variableName = "r"
            ) where TStatement : StatementSyntax
        {
            Func <SyntaxNode, TStatement> findDeclaration = root => (TStatement)FindDeclaration(root, variableName);

            Verify(
                tryGetAction.AsTransformer(),
                findDeclaration,
                findDeclaration,
                expected,
                code
                );
        }