public void test_THAT_field_ref_operand_from_indexer_with_constant_param_IS_created_successfully() { Expression <Func <SPListItem, bool> > expr = x => (string)x["Email"] == "*****@*****.**"; var operandBuilder = new OperandBuilder(); var operand = operandBuilder.CreateFieldRefOperand(((BinaryExpression)expr.Body).Left, null); Assert.That(operand, Is.InstanceOf <FieldRefOperand>()); Assert.That(((FieldRefOperand)operand).FieldName, Is.EqualTo("Email")); }
public void test_WHEN_string_based_value_is_user_id_THEN_lookup_field_ref_operand_is_created() { Expression <Func <SPListItem, bool> > expr = x => x["foo"] == (DataTypes.UserId) "1"; var operandBuilder = new OperandBuilder(); var operand = operandBuilder.CreateFieldRefOperand(((BinaryExpression)expr.Body).Left, new UserIdValueOperand("1")); Assert.That(operand, Is.InstanceOf <FieldRefOperand>()); var op = (FieldRefOperand)operand; Assert.That(op.Attributes.Count, Is.EqualTo(1)); Assert.That(op.Attributes[0].Key, Is.EqualTo("LookupId")); Assert.That(op.Attributes[0].Value, Is.EqualTo("True")); }