public void test_THAT_leq_operation_IS_converted_to_expression_correctly() { var op1 = new FieldRefOperand("Count"); var op2 = new IntegerValueOperand(1); var op = new LeqOperation(null, op1, op2); var expr = op.ToExpression(); Assert.That(expr.ToString(), Is.EqualTo("(Convert(x.get_Item(\"Count\")) <= 1)")); }
public void test_THAT_leq_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 LeqOperation(resultBuilder, fieldRefOperandStub, valueOperandStub); // act string caml = operation.ToResult().ToString(); // assert string expected = @"<Leq> <fieldRefOperandStub /> <valueOperandStub /> </Leq>"; Assert.That(caml, Is.EqualTo(expected).Using(new CamlComparer())); }