private MemberDeclarationSyntax MockVirtualMethod()
        {
            var parameters = F.SeparatedList(Symbol.Parameters.Select(ps => TypesForSymbols.AsParameterSyntax(ps)));

            if (ArglistParameterName != null && TypesForSymbols.RuntimeArgumentHandle() != null)
            {
                parameters = parameters.Add(F.Parameter(F.Identifier(ArglistParameterName)).WithType(TypesForSymbols.RuntimeArgumentHandle()));
            }

            var method = F.MethodDeclaration(ReturnTypeWithoutReadonly, F.Identifier(MemberMockName))
                         .WithModifiers(F.TokenList(F.Token(SyntaxKind.ProtectedKeyword), F.Token(SyntaxKind.VirtualKeyword)))
                         .WithParameterList(F.ParameterList(parameters))
                         .WithBody(F.Block(ThrowMockMissingStatement("VirtualMethod")));

            if (Symbol.TypeParameters.Any())
            {
                method = method.WithTypeParameterList(TypeParameterList());

                var constraints = TypesForSymbols.AsConstraintClauses(Symbol.TypeParameters);

                if (constraints.Any())
                {
                    method = method.AddConstraintClauses(constraints);
                }
            }

            return(method);
        }
        private MemberDeclarationSyntax MockProviderMethod()
        {
            var m = F.MethodDeclaration(MockMemberType, F.Identifier(MemberMockName)).WithTypeParameterList(TypeParameterList());

            m = m.WithModifiers(F.TokenList(F.Token(SyntaxKind.PublicKeyword)));

            var keyCreation = F.LocalDeclarationStatement(F.VariableDeclaration(F.IdentifierName("var")).WithVariables(F.SingletonSeparatedList(F
                                                                                                                                                .VariableDeclarator(F.Identifier("key")).WithInitializer(F.EqualsValueClause(TypesOfTypeParameters())))));

            var mockCreation = F.SimpleLambdaExpression(F.Parameter(F.Identifier("keyString")), F.ObjectCreationExpression(MockMemberType)
                                                        .WithExpressionsAsArgumentList(
                                                            F.ThisExpression(),
                                                            F.LiteralExpression(SyntaxKind.StringLiteralExpression, F.Literal(ClassSymbol.Name)),
                                                            F.LiteralExpression(SyntaxKind.StringLiteralExpression, F.Literal(InterfaceSymbol.Name)),
                                                            F.BinaryExpression(SyntaxKind.AddExpression, F.LiteralExpression(SyntaxKind.StringLiteralExpression, F.Literal(Symbol.Name)),
                                                                               F.IdentifierName("keyString")),
                                                            F.BinaryExpression(SyntaxKind.AddExpression,
                                                                               F.BinaryExpression(SyntaxKind.AddExpression,
                                                                                                  F.LiteralExpression(SyntaxKind.StringLiteralExpression, F.Literal(MemberMockName)), F.IdentifierName("keyString")),
                                                                               F.LiteralExpression(
                                                                                   SyntaxKind.StringLiteralExpression,
                                                                                   F.Literal("()"))),
                                                            StrictnessExpression()
                                                            ));

            var returnStatement = F.ReturnStatement(F.CastExpression(MockMemberType, F.InvocationExpression(
                                                                         F.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, F.IdentifierName(MockProviderName),
                                                                                                  F.IdentifierName("GetOrAdd")))
                                                                     .WithArgumentList(
                                                                         F.ArgumentList(F.SeparatedList(new[] { F.Argument(F.IdentifierName("key")), F.Argument(mockCreation) })))));

            m = m.WithBody(F.Block(keyCreation, returnStatement));

            var constraints = TypesForSymbols.AsConstraintClauses(Symbol.TypeParameters);

            if (constraints.Any())
            {
                m = m.AddConstraintClauses(constraints);
            }

            return(m);
        }