Exemple #1
0
 public Task ZeroEqualsProperty_Fixed()
 => VerifyAsync(
     methodName: null,
     testSource: SourceProvider.GetCodeWithExpression(
         SourceProvider.GetTargetPropertyEqualsInvocationCode(0, SourceProvider.MemberName)),
     fixedSource: SourceProvider.GetCodeWithExpression(
         SourceProvider.GetFixedIsEmptyPropertyCode(negate: false)),
     extensionsSource: null);
Exemple #2
0
 public Task ZeroEqualsLinqCount_Fixed()
 => VerifyAsync(
     methodName: null,
     testSource: SourceProvider.GetCodeWithExpression(
         SourceProvider.GetTargetExpressionEqualsInvocationCode(0, withPredicate: false, "Count"),
         additionalNamspaces: SourceProvider.ExtensionsNamespace),
     fixedSource: SourceProvider.GetCodeWithExpression(
         SourceProvider.GetFixedIsEmptyPropertyCode(negate: false),
         additionalNamspaces: SourceProvider.ExtensionsNamespace),
     extensionsSource: null);
Exemple #3
0
        public Task LinqMethodOnBinaryOperation(int literal, BinaryOperatorKind @operator, bool isRightSideExpression, bool shouldNegate)
        {
            string testSource = SourceProvider.GetCodeWithExpression(
                isRightSideExpression ?
                SourceProvider.GetTargetExpressionBinaryExpressionCode(literal, @operator, withPredicate: false, "Count") :
                SourceProvider.GetTargetExpressionBinaryExpressionCode(@operator, literal, withPredicate: false, "Count"),
                additionalNamspaces: SourceProvider.ExtensionsNamespace);

            string fixedSource = SourceProvider.GetCodeWithExpression(
                SourceProvider.GetFixedIsEmptyPropertyCode(shouldNegate),
                additionalNamspaces: SourceProvider.ExtensionsNamespace);

            return(VerifyAsync(methodName: null, testSource, fixedSource, extensionsSource: null));
        }
Exemple #4
0
        public Task PropertyOnBinaryOperation(bool noDiagnosis, int literal, BinaryOperatorKind @operator, bool isRightSideExpression, bool shouldNegate)
        {
            string testSource = isRightSideExpression ?
                                SourceProvider.GetTargetPropertyBinaryExpressionCode(literal, @operator, SourceProvider.MemberName) :
                                SourceProvider.GetTargetPropertyBinaryExpressionCode(@operator, literal, SourceProvider.MemberName);

            testSource = SourceProvider.GetCodeWithExpression(testSource);

            if (noDiagnosis)
            {
                return(VerifyAsync(testSource, extensionsSource: null));
            }
            else
            {
                string fixedSource = SourceProvider.GetCodeWithExpression(SourceProvider.GetFixedIsEmptyPropertyCode(shouldNegate));
                return(VerifyAsync(methodName: null, testSource, fixedSource, extensionsSource: null));
            }
        }