private async Task <Document> CompleteWithItIsAny(Document document, TypeDeclarationSyntax typeDecl, CancellationToken cancellationToken, ArgumentListSyntax mockedMethod) { var mockedMethodDeclaration = SymbolFinder.FindDeclarationsAsync( document.Project, ((IdentifierNameSyntax)((MemberAccessExpressionSyntax)((InvocationExpressionSyntax)mockedMethod.Parent).Expression).Name).Identifier.ValueText, false, cancellationToken).Result; var parameters = ((IMethodSymbol)mockedMethodDeclaration.First()).Parameters; var length = parameters.Length; SeparatedSyntaxList <ArgumentSyntax> arguments = mockedMethod.Arguments; for (int index = 0; index < length; index++) { var argument = arguments.ElementAtOrDefault(index); var isMissing = argument?.IsMissing ?? true; if (isMissing) { var parameter = parameters[index]; if (argument != null) { arguments = arguments.RemoveAt(index); } var argumentSyntax = SyntaxFactory.Argument( SyntaxFactory.InvocationExpression( SyntaxFactory.MemberAccessExpression( SyntaxKind.SimpleMemberAccessExpression, SyntaxFactory.IdentifierName("It"), SyntaxFactory.GenericName(SyntaxFactory.Identifier("IsAny")) .WithTypeArgumentList( SyntaxFactory.TypeArgumentList( SyntaxFactory.SingletonSeparatedList( SyntaxFactory.ParseTypeName(parameter.ToDisplayString())))))) .NormalizeWhitespace()); arguments = arguments.Insert(index, argumentSyntax); } } var updatedMockedMethod = mockedMethod.WithArguments(arguments); var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken); var updatedSyntaxTree = syntaxTree.GetRoot().ReplaceNode(mockedMethod, updatedMockedMethod); return(document.WithSyntaxRoot(updatedSyntaxTree)); return(null); // Compute new uppercase name. var identifierToken = typeDecl.Identifier; var newName = identifierToken.Text.ToUpperInvariant(); // Get the symbol representing the type to be renamed. var semanticModel = await document.GetSemanticModelAsync(cancellationToken); var typeSymbol = semanticModel.GetDeclaredSymbol(typeDecl, cancellationToken); // Produce a new solution that has all references to that type renamed, including the declaration. var originalSolution = document.Project.Solution; var optionSet = originalSolution.Workspace.Options; var newSolution = await Renamer.RenameSymbolAsync(document.Project.Solution, typeSymbol, newName, optionSet, cancellationToken).ConfigureAwait(false); // Return the new solution with the now-uppercase type name. //return newSolution; }