Exemplo n.º 1
0
        public ClassDeclarationSyntax StubMethod(ClassDeclarationSyntax classDclr, IMethodSymbol methodSymbol, INamedTypeSymbol stubbedInterface, SemanticModel semanticModel)
        {
            if (methodSymbol.IsPropertyAccessor() || methodSymbol.IsOrdinaryMethod())
            {
                string delegateTypeName = NamingUtils.GetDelegateTypeName(methodSymbol, stubbedInterface);
                string setupMethodName  = NamingUtils.GetSetupMethodName(methodSymbol);

                DelegateDeclarationSyntax delegateDclr = GenerateDelegateDclr(methodSymbol, delegateTypeName,
                                                                              stubbedInterface);
                MethodDeclarationSyntax propDclr = GenerateSetupMethod(methodSymbol, setupMethodName, delegateTypeName,
                                                                       stubbedInterface, classDclr);
                classDclr = classDclr.AddMembers(delegateDclr, propDclr);
            }

            return(classDclr);
        }