예제 #1
0
        private static MethodDeclarationSyntax GenerateCreateSut(
            ClassDeclarationSyntax classDeclaration,
            MethodInspector constructorInspector)
        {
            var methodBuilder = new MethodBuilder(GH.IdentifierToken("CreateSut"))
                                .Modifiers(Modifiers.Private);

            var constructorParameters = constructorInspector
                                        .Parameters
                                        .Select(p => SF.Argument(
                                                    EGH.MemberAccess(
                                                        EGH.ThisMemberAccess(
                                                            GH.Identifier(MockName(p.Name))
                                                            ),
                                                        GH.Identifier("Object")
                                                        )
                                                    )
                                                );

            methodBuilder.ArrowBody(
                EGH.Arrow(
                    EGH.CreateObject(
                        SF.IdentifierName(classDeclaration.Identifier),
                        constructorParameters.ToArray())));

            return(methodBuilder.Build());
        }