public void test_THAT_neq_operation_with_double_IS_converted_to_expression_correctly(double value, string result) { var op1 = new FieldRefOperand("Status"); var op2 = new NumberValueOperand(value); var op = new NeqOperation(null, op1, op2); var expr = op.ToExpression(); Assert.That(expr.ToString(), Is.EqualTo(result)); }
public void test_THAT_neq_operation_with_bool_IS_converted_to_expression_correctly() { var op1 = new FieldRefOperand("Status"); var op2 = new BooleanValueOperand(true); var op = new NeqOperation(null, op1, op2); var expr = op.ToExpression(); Assert.That(expr.ToString(), Is.EqualTo("(Convert(x.get_Item(\"Status\")) != True)")); }
public void test_THAT_neq_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 NeqOperation(resultBuilder, fieldRefOperandStub, valueOperandStub); // act string caml = operation.ToResult().ToString(); // assert string expected = @"<Neq> <fieldRefOperandStub /> <valueOperandStub /> </Neq>"; Assert.That(caml, Is.EqualTo(expected).Using(new CamlComparer())); }