Esempio n. 1
0
 public static void Verify <TInput, TOutput>(
     TryGetAction2 <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
         );
 }
Esempio n. 2
0
        public static StatementTransformer <TStatement> AsTransformer <TStatement>(
            this TryGetAction2 <TStatement> tryGetAction
            )
            where TStatement : StatementSyntax
        {
            return((inputStatement, root, semanticModel) =>
            {
                Func <SyntaxNode, SyntaxNode> action;

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

                return action(root);
            });
        }
Esempio n. 3
0
        public static void VerifyDeclaration <TStatement>(
            TryGetAction2 <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
                );
        }