Exemple #1
0
        public Task PropertyOnBinaryOperationAsync(int literal, BinaryOperatorKind @operator, bool isRightSideExpression)
        {
            string testSource;
            string fixedSource;

            if (isRightSideExpression)
            {
                testSource  = SourceProvider.GetTargetExpressionBinaryExpressionCode(literal, @operator, withPredicate: false, "Count");
                fixedSource = SourceProvider.GetTargetPropertyBinaryExpressionCode(literal, @operator, SourceProvider.MemberName);
            }
            else
            {
                testSource  = SourceProvider.GetTargetExpressionBinaryExpressionCode(@operator, literal, withPredicate: false, "Count");
                fixedSource = SourceProvider.GetTargetPropertyBinaryExpressionCode(@operator, literal, SourceProvider.MemberName);
            }

            testSource = SourceProvider.GetCodeWithExpression(
                testSource, additionalNamspaces: SourceProvider.ExtensionsNamespace);

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

            int line   = VerifierBase.GetNumberOfLines(testSource) - 3;
            int column = isRightSideExpression ?
                         21 + 3 + GetOperatorLength(SourceProvider, @operator) :
                         21;

            return(VerifyAsync(SourceProvider.MemberName, testSource, fixedSource, extensionsSource: null, line, column));
        }
 protected Task VerifyAsync(string methodName, string testSource, string fixedSource, string extensionsSource)
 => Verifier.VerifyAsync(
     methodName,
     new string[] { testSource, extensionsSource },
     new string[] { fixedSource, extensionsSource },
     line: VerifierBase.GetNumberOfLines(testSource) - 3,
     column: 21);