Exemplo n.º 1
0
        public void test_THAT_includes_operation_IS_converted_to_expression_correctly()
        {
            var        op1  = new FieldRefOperand("Count");
            var        op2  = new IntegerValueOperand(1);
            var        op   = new IncludesOperation(null, op1, op2);
            Expression expr = op.ToExpression();

            Assert.That(expr.ToString(), Is.EqualTo("Convert(Convert(x.get_Item(\"Count\"))).Includes(Convert(1))"));
        }
Exemplo n.º 2
0
        public void test_THAT_includes_operation_with_lookup_id_IS_converted_to_expression_correctly()
        {
            var attr = new List <KeyValuePair <string, string> >();

            attr.Add(new KeyValuePair <string, string>(Attributes.LookupId, "True"));
            var        op1  = new FieldRefOperand("Count", attr);
            var        op2  = new IntegerValueOperand(1);
            var        op   = new IncludesOperation(null, op1, op2);
            Expression expr = op.ToExpression();

            Assert.That(expr.ToString(), Is.EqualTo("Convert(Convert(x.get_Item(\"Count\"))).Includes(Convert(1), True)"));
        }
Exemplo n.º 3
0
        public void test_THAT_includes_operation_IS_rendered_to_caml_properly()
        {
            // arrange
            var fieldRefOperandStub = MockRepository.GenerateStub <FieldRefOperand>("");
            var valueOperandStub    = MockRepository.GenerateStub <TextValueOperand>("");

            fieldRefOperandStub.Stub(o => o.ToCaml()).Return(new XElement("fieldRefOperandStub"));
            valueOperandStub.Stub(o => o.ToCaml()).Return(new XElement("valueOperandStub"));

            var resultBuilder = new OperationResultBuilder();
            var operation     = new IncludesOperation(resultBuilder, fieldRefOperandStub, valueOperandStub);

            // act
            var caml = operation.ToResult().ToString();

            // assert
            const string expected =
                @"<Includes>
                    <fieldRefOperandStub />
                    <valueOperandStub />
                </Includes>";

            Assert.That(caml, Is.EqualTo(expected).Using(new CamlComparer()));
        }