public IExpression CreateMigrationExpression(IInvocationExpression invocationExpression) { var arguments = invocationExpression.Arguments .Select(x => x.Value) .ToArray(); if (!arguments.Any()) { return(invocationExpression); } var factory = CSharpElementFactory.GetInstance(invocationExpression); var actualValue = GetActualValue(arguments); var shouldMethod = invocationExpression.GetFluentAssertionsPredefinedType().GetShouldMethod(actualValue.Type()); if (shouldMethod is null) { return(invocationExpression); } var shouldExpression = factory.CreateReferenceExpression("$0.$1", actualValue, shouldMethod); var replacementMethod = GetReplacementMethod(shouldMethod); if (replacementMethod is null) { return(invocationExpression); } var replacementMethodExpression = factory.CreateReferenceExpression("$0().$1", shouldExpression, replacementMethod); var list = new List <object> { replacementMethodExpression }; var expectedValue = GetExpectedValue(arguments); if (expectedValue != null) { list.Add(expectedValue); list.AddRange(arguments.Skip(GetExpectedValueSkipArgumentsCount())); } else { list.AddRange(arguments.Skip(1)); } var expressionFormat = $"$0({list.GetExpressionFormatArguments()})"; return(factory.CreateExpression(expressionFormat, list.ToArray())); }