public void test_WHEN_single_xelement_passed_THEN_xelement_operation_result_is_created()
        {
            var operationResultBuilder = new OperationResultBuilder();
            var result = operationResultBuilder.CreateResult(new XElement("foo"));

            Assert.That(result, Is.InstanceOf <XElementOperationResult>());
        }
        public void test_WHEN_multiple_xelements_passed_THEN_xelement_array_operation_result_is_created()
        {
            var operationResultBuilder = new OperationResultBuilder();
            var result = operationResultBuilder.CreateResult(new[] { new XElement("foo"), new XElement("foo") });

            Assert.That(result, Is.InstanceOf <XElementArrayOperationResult>());
        }
Пример #3
0
        public override IOperationResult ToResult()
        {
            string result;

            if (ValueOperand is TextValueOperand)
            {
                string value = ((string)ValueOperand.GetValue()).TrimEnd('*').TrimStart('*');
                result = string.Format("CONTAINS({0},'\"{1}*\"')", ColumnOperand, value);
            }
            else
            {
                result = string.Format("CONTAINS({0},'\"{1}*\"')", ColumnOperand, ValueOperand.GetValue());
            }

            return(OperationResultBuilder.CreateResult(result));
        }
Пример #4
0
        public override IOperationResult ToResult()
        {
            string result;

            if (ValueOperand is TextValueOperand)
            {
                string value = (string)ValueOperand.GetValue();
                result = value.Contains("*")
                             ? string.Format("CONTAINS({0},'\"{1}\"')", ColumnOperand, value)
                             : string.Format("CONTAINS({0},{1})", ColumnOperand, ValueOperand);
            }
            else
            {
                result = string.Format("CONTAINS({0},{1})", ColumnOperand, ValueOperand);
            }

            return(OperationResultBuilder.CreateResult(result));
        }