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