-Fixed tests

This commit is contained in:
James Newton-King
2016-12-26 15:00:40 +13:00
parent 4099870390
commit 5d7300f5b4
2 changed files with 6 additions and 6 deletions
@@ -52,8 +52,8 @@ namespace Newtonsoft.Json.Tests.Linq.JsonPath
JPath path = new JPath("[?(1 > 2)]"); JPath path = new JPath("[?(1 > 2)]");
Assert.AreEqual(1, path.Filters.Count); Assert.AreEqual(1, path.Filters.Count);
BooleanQueryExpression booleanExpression = (BooleanQueryExpression)((QueryFilter)path.Filters[0]).Expression; BooleanQueryExpression booleanExpression = (BooleanQueryExpression)((QueryFilter)path.Filters[0]).Expression;
Assert.AreEqual(new JValue(1), booleanExpression.Left); Assert.AreEqual(1, (int)(JValue)booleanExpression.Left);
Assert.AreEqual(new JValue(1), booleanExpression.Right); Assert.AreEqual(2, (int)(JValue)booleanExpression.Right);
Assert.AreEqual(QueryOperator.GreaterThan, booleanExpression.Operator); Assert.AreEqual(QueryOperator.GreaterThan, booleanExpression.Operator);
} }
+4 -4
View File
@@ -450,7 +450,7 @@ namespace Newtonsoft.Json.Linq.JsonPath
return true; return true;
} }
private JsonException ThrowUnexpectedCharacterException() private JsonException CreateUnexpectedCharacterException()
{ {
return new JsonException("Unexpected character while parsing path query: " + _expression[_currentIndex]); return new JsonException("Unexpected character while parsing path query: " + _expression[_currentIndex]);
} }
@@ -477,7 +477,7 @@ namespace Newtonsoft.Json.Linq.JsonPath
return new JValue(value); return new JValue(value);
} }
throw ThrowUnexpectedCharacterException(); throw CreateUnexpectedCharacterException();
} }
private QueryExpression ParseExpression() private QueryExpression ParseExpression()
@@ -525,7 +525,7 @@ namespace Newtonsoft.Json.Linq.JsonPath
{ {
if (!Match("&&")) if (!Match("&&"))
{ {
throw ThrowUnexpectedCharacterException(); throw CreateUnexpectedCharacterException();
} }
if (parentExpression == null || parentExpression.Operator != QueryOperator.And) if (parentExpression == null || parentExpression.Operator != QueryOperator.And)
@@ -551,7 +551,7 @@ namespace Newtonsoft.Json.Linq.JsonPath
{ {
if (!Match("||")) if (!Match("||"))
{ {
throw ThrowUnexpectedCharacterException(); throw CreateUnexpectedCharacterException();
} }
if (parentExpression == null || parentExpression.Operator != QueryOperator.Or) if (parentExpression == null || parentExpression.Operator != QueryOperator.Or)