Exemplo n.º 1
0
        public void test_THAT_boolean_value_IS_rendered_to_caml_properly()
        {
            var    operand = new BooleanValueOperand(true);
            string caml    = operand.ToCaml().ToString();

            Assert.That(caml, Is.EqualTo("<Value Type=\"Boolean\">1</Value>"));
        }
        public void test_THAT_operand_with_false_IS_conveted_to_expression_correctly()
        {
            var op   = new BooleanValueOperand(false);
            var expr = op.ToExpression();

            Assert.That(expr.ToString(), Is.EqualTo("false").Using(new CaseInsensetiveComparer()));
        }
        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)"));
        }
Exemplo n.º 4
0
        public void test_THAT_or_else_operation_IS_converted_to_expression_correctly()
        {
            var op11 = new FieldRefOperand("Status");
            var op12 = new BooleanValueOperand(true);
            var op1  = new EqOperation(null, op11, op12);

            var op21 = new FieldRefOperand("Status");
            var op22 = new BooleanValueOperand(false);
            var op2  = new EqOperation(null, op21, op22);

            var op = new OrElseOperation(null, op1, op2);

            var expr = op.ToExpression();

            Assert.That(expr.ToString(), Is.EqualTo("(Convert(x.get_Item(\"Status\")) OrElse Not(Convert(x.get_Item(\"Status\"))))"));
        }
Exemplo n.º 5
0
        public void test_THAT_boolean_value_IS_successfully_created_from_valid_string4()
        {
            var operand = new BooleanValueOperand("0");

            Assert.That(operand.Value, Is.False);
        }
Exemplo n.º 6
0
        public void test_WHEN_string_is_not_valid_boolean_THEN_exception_is_thrown2()
        {
            var operand = new BooleanValueOperand("2");

            Assert.That(operand.Value, Is.False);
        }