public void test_THAT_string_based_null_expression_IS_valid_isnull_expression()
        {
            var operandBuilder = MockRepository.GenerateStub <IOperandBuilder>();

            operandBuilder.Stub(b => b.CreateValueOperandForNativeSyntax(null)).Return(new NullValueOperand()).IgnoreArguments();

            var analyzer = new IsNullAnalyzer(null, operandBuilder);
            Expression <Func <SPListItem, bool> > expr = x => x["Count"] == (DataTypes.Integer)null;

            Assert.That(analyzer.IsValid(expr), Is.True);
        }
        public void test_THAT_isnull_expression_IS_determined_properly()
        {
            // arrange
            Expression <Func <SPListItem, bool> > expr = x => x["Count"] == null;

            var operandBuilder = MockRepository.GenerateStub <IOperandBuilder>();

            operandBuilder.Stub(b => b.CreateFieldRefOperand(expr.Body, null)).Return(null);
            operandBuilder.Stub(b => b.CreateValueOperandForNativeSyntax(expr.Body)).Return(new NullValueOperand()).IgnoreArguments();

            var analyzer = new IsNullAnalyzer(null, operandBuilder);

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

            //assert
            Assert.That(operation, Is.InstanceOf <IsNullOperation>());
        }
 private bool isNullExpression(LambdaExpression expr, out IsNullAnalyzer analyzer)
 {
     // the simplest way to check if this IsNotNull expression - is to reuse IsNotNullAnalyzer
     analyzer = new IsNullAnalyzer(this.operationResultBuilder, this.operandBuilder);
     return(analyzer.IsValid(expr));
 }