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))")); }
public void ToString_OperatorAndWithoutOperands_OutputsString() { var node = new JsonCriteriaNode { Operator = Operator.And, Operands = new List<JsonCriteriaNode>() }; Assert.That(node.ToString(), Is.EqualTo("()")); }
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))); }
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))); }
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]))); }
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))); }