예제 #1
0
        public void ToString_OperatorAndWithOperands_OutputsString()
        {
            const string key = "TestKey";
            const string value = "TestValue";

            var node = new JsonCriteriaNode
            {
                Operator = Operator.And,
                Operands = new List<JsonCriteriaNode>
                {
                    new JsonCriteriaNode
                    {
                        Operator = Operator.Equal,
                        Key = key,
                        Value = value
                    },
                    new JsonCriteriaNode
                    {
                        Operator = Operator.NotEqual,
                        Key = key,
                        Value = value
                    },
                }
            };

            Assert.That(node.ToString(), Is.EqualTo("((TestKey == TestValue) && (TestKey != TestValue))"));
        }
예제 #2
0
        public void ToString_OperatorAndWithoutOperands_OutputsString()
        {
            var node = new JsonCriteriaNode
            {
                Operator = Operator.And,
                Operands = new List<JsonCriteriaNode>()
            };

            Assert.That(node.ToString(), Is.EqualTo("()"));
        }
예제 #3
0
        public void ToString_OperatorBetween_OutputsString()
        {
            const string key = "TestKey";
            const string value = "TestValue";

            var node = new JsonCriteriaNode
            {
                Operator = Operator.Between,
                Key = key,
                Value = value
            };

            Assert.That(node.ToString(), Is.EqualTo(String.Format("({0} Between {1})", key, value)));
        }
예제 #4
0
        public void ToString_OperatorIsSpecified_OutputsString()
        {
            const string key = "TestKey";
            const string value = "TestValue";

            var node = new JsonCriteriaNode
            {
                Operator = Operator.IsSpecified,
                Key = key,
                Value = value
            };

            Assert.That(node.ToString(), Is.EqualTo(String.Format("({0} IsSpecified)", key)));
        }
예제 #5
0
        public void ToString_OperatorIsNotIn_OutputsString()
        {
            const string key = "TestKey";
            var value = new[] { "TestValue", "OtherTestValue" };

            var node = new JsonCriteriaNode
            {
                Operator = Operator.IsNotIn,
                Key = key,
                Value = value
            };

            Assert.That(node.ToString(), Is.EqualTo(String.Format("({0} IsNotIn [{1}, {2}])", key, value[0], value[1])));
        }
예제 #6
0
        public void ToString_OperatorDoesNotStartWith_OutputsString()
        {
            const string key = "TestKey";
            const string value = "TestValue";

            var node = new JsonCriteriaNode
            {
                Operator = Operator.DoesNotStartWith,
                Key = key,
                Value = value
            };

            Assert.That(node.ToString(), Is.EqualTo(String.Format("({0} DoesNotStartWith {1})", key, value)));
        }