示例#1
0
        public void test_THAT_includes_expression_with_custom_note_type_IS_determined_properly()
        {
            // arrange
            Expression <Func <SPListItem, bool> > expr = x => ((DataTypes.Note)x["Count"]).Includes("foo");
            var operandBuilder = MockRepository.GenerateStub <IOperandBuilder>();

            operandBuilder.Stub(b => b.CreateFieldRefOperand(((MethodCallExpression)expr.Body).Object, null)).Return(null);
            operandBuilder.Stub(b => b.CreateValueOperandForNativeSyntax(((MethodCallExpression)expr.Body).Arguments[0])).Return(null);
            var analyzer = new IncludesAnalyzer(null, operandBuilder);

            // act
            var operation = analyzer.GetOperation(expr);

            //assert
            Assert.That(operation, Is.InstanceOf <IncludesOperation>());
        }
示例#2
0
        public override IOperation GetOperation(LambdaExpression expr)
        {
            if (!IsValid(expr))
            {
                throw new NonSupportedExpressionException(expr);
            }

//            var fieldRefOperand = getFieldRefOperand(expr);
//            var valueOperand = getValueOperand(expr);
//            return new NotIncludesOperation(operationResultBuilder, fieldRefOperand, valueOperand);
            var subExpr           = this.getSubExpr(expr);
            var includesAnalyzer  = new IncludesAnalyzer(this.operationResultBuilder, this.operandBuilder);
            var includesOperation = (IncludesOperation)includesAnalyzer.GetOperation(Expression.Lambda(subExpr, expr.Parameters));

            return(new NotIncludesOperation(operationResultBuilder, includesOperation.FieldRefOperand, includesOperation.ValueOperand));
        }