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

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

                return action(root, semanticModel);
            });
        }
Example #3
0
        public static void VerifyDeclaration <TStatement>(
            TryGetAction1 <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
                );
        }