public void test_THAT_string_based_eq_expression_IS_not_valid() { var analyzer = new EqAnalyzer(null, null); Expression <Func <SPListItem, bool> > expr = x => x["Title"] == (DataTypes.Text) new BaseFieldType(); Assert.That(analyzer.IsValid(expr), Is.False); }
public void test_THAT_eq_expression_IS_valid() { var analyzer = new EqAnalyzer(null, null); Expression <Func <SPListItem, bool> > expr = x => (string)x["Title"] == "testValue"; Assert.That(analyzer.IsValid(expr), Is.True); }
public void test_THAT_string_based_eq_expression_with_variable_IS_not_valid() { var analyzer = new EqAnalyzer(null, null); var foo = new DataTypes.Text(); Expression <Func <SPListItem, bool> > expr = x => x["Title"] == foo; Assert.That(analyzer.IsValid(expr), Is.False); }
public void test_THAT_string_based_eq_expression_IS_determined_properly() { // arrange Expression <Func <SPListItem, bool> > expr = x => x["Title"] == (DataTypes.Text) "testValue"; var operandBuilder = MockRepository.GenerateStub <IOperandBuilder>(); operandBuilder.Stub(b => b.CreateFieldRefOperand(expr.Body, null)).Return(null); operandBuilder.Stub(b => b.CreateValueOperandForNativeSyntax(expr.Body)).Return(null); var analyzer = new EqAnalyzer(null, operandBuilder); // act var operation = analyzer.GetOperation(expr); //assert Assert.That(operation, Is.InstanceOf <EqOperation>()); }