コード例 #1
0
 public static bool AssignsParameterUsingIsNullOrEmptyCheck(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.ParameterAssignedUsingStatement(
     TwoFerAssignParameterStatement(
         TwoFerParameterIsNullOrEmptyConditionalExpression(twoFerSolution),
         TwoFerParameterIdentifierName(twoFerSolution)));
コード例 #2
0
 public static IdentifierNameSyntax TwoFerParameterIdentifierName(TwoFerSolution solution) =>
 IdentifierName(solution.SpeakMethodParameterName);
コード例 #3
0
 public static ConditionalExpressionSyntax TwoFerConditionalExpressionWithNullCheck(TwoFerSolution solution) =>
 TwoFerConditionalExpression(
     EqualsExpression(
         IdentifierName(solution.SpeakMethodParameterName),
         NullLiteralExpression()),
     IdentifierName(solution.SpeakMethodParameterName));
コード例 #4
0
 private static bool ReturnsStringConcatenationWithTernaryOperator(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.ReturnsStringConcatenationWithNullCheck() ||
 twoFerSolution.ReturnsStringConcatenationWithIsNullOrEmptyCheck() ||
 twoFerSolution.ReturnsStringConcatenationWithIsNullOrWhiteSpaceCheck();
コード例 #5
0
 public static ConditionalExpressionSyntax TwoFerParameterIsNullOrWhiteSpaceConditionalExpression(TwoFerSolution solution) =>
 TwoFerConditionalExpression(
     TwoFerIsNullOrWhiteSpaceInvocationExpression(solution),
     TwoFerParameterIdentifierName(solution));
コード例 #6
0
 public static bool UsesInvalidDefaultValue(this TwoFerSolution twoFerSolution) =>
 !twoFerSolution.InputParameter.Default.Value.IsEquivalentWhenNormalized(NullLiteralExpression()) &&
 !twoFerSolution.InputParameter.Default.Value.IsEquivalentWhenNormalized(StringLiteralExpression("you"));
コード例 #7
0
 private static bool ReturnsStringConcatenationWithDefaultValue(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.Returns(
     TwoFerStringConcatenationExpression(
         TwoFerParameterIdentifierName(twoFerSolution)));
コード例 #8
0
 public static bool AssignsVariableUsingNullCoalescingOperator(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.AssignsVariableUsingExpression(
     TwoFerCoalesceExpression(
         TwoFerParameterIdentifierName(twoFerSolution)));
コード例 #9
0
 public static bool AssignsVariableUsingIsNullOrWhiteSpaceCheck(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.AssignsVariableUsingExpression(
     TwoFerParameterIsNullOrWhiteSpaceConditionalExpression(twoFerSolution));
コード例 #10
0
 public static bool AssignsVariable(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.Variable != null;
コード例 #11
0
 public static bool AssignsVariableUsingKnownInitializer(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.AssignsVariableUsingNullCoalescingOperator() ||
 twoFerSolution.AssignsVariableUsingNullCheck() ||
 twoFerSolution.AssignsVariableUsingIsNullOrEmptyCheck() ||
 twoFerSolution.AssignsVariableUsingIsNullOrWhiteSpaceCheck();
コード例 #12
0
 private static StatementSyntax AssignmentStatement(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.SpeakMethod.Body.Statements[0];
コード例 #13
0
 private static bool ParameterAssignedUsingStatement(this TwoFerSolution twoFerSolution, SyntaxNode statement) =>
 twoFerSolution.AssignmentStatement().IsEquivalentWhenNormalized(statement);
コード例 #14
0
 public static bool AssignsParameterUsingIfIsNullOrWhiteSpaceCheck(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.ParameterAssignedUsingStatement(
     TwoFerAssignParameterIfStatement(
         TwoFerIsNullOrWhiteSpaceInvocationExpression(twoFerSolution),
         TwoFerParameterIdentifierName(twoFerSolution)));
コード例 #15
0
 public static bool UsesSingleLine(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.SpeakMethod.SingleLine();
コード例 #16
0
 private static bool AssignsVariableUsingExpression(this TwoFerSolution twoFerSolution, ExpressionSyntax initializer) =>
 twoFerSolution.Variable.Initializer.IsEquivalentWhenNormalized(
     EqualsValueClause(initializer));
コード例 #17
0
 public static bool UsesExpressionBody(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.SpeakMethod.IsExpressionBody();
コード例 #18
0
 public static bool ReturnsStringInterpolationWithVariable(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.Returns(
     TwoFerInterpolatedStringExpression(
         TwoFerVariableIdentifierName(twoFerSolution)));
コード例 #19
0
 public static bool ReturnsStringConcatenation(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.ReturnsStringConcatenationWithDefaultValue() ||
 twoFerSolution.ReturnsStringConcatenationWithNullCoalescingOperator() ||
 twoFerSolution.ReturnsStringConcatenationWithTernaryOperator();
コード例 #20
0
 public static bool ReturnsStringFormatWithVariable(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.Returns(
     TwoFerStringFormatInvocationExpression(
         TwoFerVariableIdentifierName(twoFerSolution)));
コード例 #21
0
 private static bool ReturnsStringConcatenationWithNullCoalescingOperator(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.Returns(
     TwoFerStringConcatenationExpression(
         ParenthesizedExpression(
             TwoFerCoalesceExpression(
                 TwoFerParameterIdentifierName(twoFerSolution)))));
コード例 #22
0
 public static bool UsesStringConcat(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.SpeakMethod.InvokesMethod(StringMemberAccessExpression(IdentifierName("Concat")));
コード例 #23
0
 public static ConditionalExpressionSyntax TwoFerParameterIsNullConditionalExpression(TwoFerSolution solution) =>
 TwoFerConditionalExpression(
     TwoFerParameterIsNullExpression(solution),
     TwoFerParameterIdentifierName(solution));
コード例 #24
0
 public static bool UsesStringReplace(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.SpeakMethod.InvokesMethod(IdentifierName("Replace"));
コード例 #25
0
 public static BinaryExpressionSyntax TwoFerParameterIsNullExpression(TwoFerSolution solution) =>
 EqualsExpression(
     TwoFerParameterIdentifierName(solution),
     NullLiteralExpression());
コード例 #26
0
 public static bool AssignsToParameter(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.SpeakMethod.AssignsToParameter(twoFerSolution.InputParameter);
コード例 #27
0
 public static IdentifierNameSyntax TwoFerVariableIdentifierName(TwoFerSolution solution) =>
 IdentifierName(solution.TwoFerVariableName);
コード例 #28
0
 public static bool NoDefaultValue(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.SpeakMethod.ParameterList.Parameters.All(parameter => parameter.Default == null);
コード例 #29
0
 public static InvocationExpressionSyntax TwoFerIsNullOrEmptyInvocationExpression(TwoFerSolution twoFerSolution) =>
 TwoFerStringInvocationExpression(twoFerSolution, IdentifierName("IsNullOrEmpty"));
コード例 #30
0
 public static bool UsesOverloads(this TwoFerSolution twoFerSolution) =>
 twoFerSolution.TwoFerClass.GetMethods("Speak").Count() > 1;