示例#1
0
        public override string ToString()
        {
            StringBuilder buf = new StringBuilder();

            buf.Append("(");
            buf.Append(ConditionExpression == null ? DSDefinitions.Keyword.Null : ConditionExpression.ToString());
            buf.Append(" ? ");
            buf.Append(TrueExpression == null ? DSDefinitions.Keyword.Null : TrueExpression.ToString());
            buf.Append(" : ");
            buf.Append(FalseExpression == null ? DSDefinitions.Keyword.Null : FalseExpression.ToString());
            buf.Append(")");

            return(buf.ToString());
        }
        public void ConditionExpression_GivenIsSingleOperand()
        {
            var condition = new ConditionExpression
            {
                Left = "[[a]]",
                Cond = new ConditionMatch()
                {
                    MatchType = enDecisionType.IsNull,
                    Right     = "2",
                }
            };

            var result = condition.ToString();

            Assert.AreEqual("[[a]] Is NULL", result);
        }
        public void ConditionExpression_GivenMatchExpression()
        {
            var condition = new ConditionExpression
            {
                Left = "[[a]]",
                Cond = new ConditionMatch
                {
                    MatchType = enDecisionType.IsEqual,
                    Right     = "bob"
                }
            };

            var result = condition.ToString();

            Assert.AreEqual("[[a]] = bob", result);
        }
        public void ConditionExpression_GivenNotBetweenExpression()
        {
            var condition = new ConditionExpression
            {
                Left = "[[a]]",
                Cond = new ConditionBetween()
                {
                    MatchType = enDecisionType.NotBetween,
                    From      = "2",
                    To        = "10",
                }
            };

            var result = condition.ToString();

            Assert.AreEqual("[[a]] is less than 2 and more than 10", result);
        }