public void EvaluateArrayOutOfBoundsIndxerWithError() { JArray a = new JArray(1, 2, 3, 4, 5); ExceptionAssert.Throws<IndexOutOfRangeException>( "Index 1000 outside the bounds of JArray.", () => { a.SelectToken("[1000].Ha", true); }); }
public void EvaluateArray() { JArray a = new JArray(1, 2, 3, 4); JToken t = a.SelectToken("[1]"); Assert.IsNotNull(t); Assert.AreEqual(JTokenType.Integer, t.Type); Assert.AreEqual(2, (int)t); }
public void EvaluatePropertyOnArrayWithError() { JArray a = new JArray(1, 2, 3, 4, 5); ExceptionAssert.Throws<JsonException>( @"Property 'BlahBlah' not valid on JArray.", () => { a.SelectToken("BlahBlah", true); }); }
public void EvaluateOutOfBoundsIndxer() { JArray a = new JArray(1, 2, 3, 4, 5); JToken t = a.SelectToken("[1000].Ha"); Assert.IsNull(t); }
public void EvaluateArraySliceWithError() { JArray a = new JArray(1, 2, 3, 4, 5); ExceptionAssert.Throws<JsonException>(() => { a.SelectToken("[99:]", true); }, "Array slice of 99 to * returned no results."); ExceptionAssert.Throws<JsonException>(() => { a.SelectToken("[1:-19]", true); }, "Array slice of 1 to -19 returned no results."); ExceptionAssert.Throws<JsonException>(() => { a.SelectToken("[:-19]", true); }, "Array slice of * to -19 returned no results."); a = new JArray(); ExceptionAssert.Throws<JsonException>(() => { a.SelectToken("[:]", true); }, "Array slice of * to * returned no results."); }
public void EvaluatePropertyOnArray() { JArray a = new JArray(1, 2, 3, 4, 5); JToken t = a.SelectToken("BlahBlah"); Assert.IsNull(t); }
public void EvaluateMultiPropertyIndexOnArrayWithError() { JArray a = new JArray(1, 2, 3, 4, 5); ExceptionAssert.Throws<JsonException>(() => { a.SelectToken("['Missing','Missing2']", true); }, "Properties 'Missing', 'Missing2' not valid on JArray."); }
public void EvaluateNoResultsWithMultipleArrayIndexes() { JArray a = new JArray(1, 2, 3, 4, 5); ExceptionAssert.Throws<JsonException>(() => { a.SelectToken("[9,10]", true); }, @"Index 9 outside the bounds of JArray."); }
public void EvaluateMultipleResultsError() { JArray a = new JArray(1, 2, 3, 4, 5); ExceptionAssert.Throws<JsonException>(() => { a.SelectToken("[0, 1]"); }, @"Path returned multiple tokens."); }
public void EvaluateArrayOutOfBoundsIndxerWithError() { JArray a = new JArray(1, 2, 3, 4, 5); a.SelectToken("[1000].Ha", true); }
public void EvaluatePropertyOnArrayWithError() { JArray a = new JArray(1, 2, 3, 4, 5); a.SelectToken("BlahBlah", true); }