Esempio n. 1
0
        public void test_THAT_gt_operation_IS_converted_to_expression_correctly()
        {
            var        op1  = new FieldRefOperand("Count");
            var        op2  = new IntegerValueOperand(1);
            var        op   = new GtOperation(null, op1, op2);
            Expression expr = op.ToExpression();

            Assert.That(expr.ToString(), Is.EqualTo("(Convert(x.get_Item(\"Count\")) > 1)"));
        }
Esempio n. 2
0
        public void test_THAT_gt_operation_with_double_IS_converted_to_expression_correctly(double value, string result)
        {
            var        op1  = new FieldRefOperand("Count");
            var        op2  = new NumberValueOperand(value);
            var        op   = new GtOperation(null, op1, op2);
            Expression expr = op.ToExpression();

            Assert.That(expr.ToString(), Is.EqualTo(result));
        }
        public void test_THAT_gt_operation_IS_rendered_to_caml_properly()
        {
            // arrange
            var fieldRefOperandStub = MockRepository.GenerateStub <FieldRefOperand>("");
            var valueOperandStub    = MockRepository.GenerateStub <IntegerValueOperand>(0);

            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 GtOperation(resultBuilder, fieldRefOperandStub, valueOperandStub);

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

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

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