本文整理汇总了C#中JPath类的典型用法代码示例。如果您正苦于以下问题:C# JPath类的具体用法?C# JPath怎么用?C# JPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JPath类属于命名空间,在下文中一共展示了JPath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QuotedWildcardPropertyWithRoot
public void QuotedWildcardPropertyWithRoot()
{
JPath path = new JPath("$.['*']");
Assert.AreEqual(1, path.Filters.Count);
Assert.AreEqual("*", ((FieldFilter)path.Filters[0]).Name);
}
示例2: AdjacentIndexers
public void AdjacentIndexers()
{
JPath path = new JPath("[1][0][0][" + int.MaxValue + "]");
Assert.AreEqual(4, path.Filters.Count);
Assert.AreEqual(1, ((ArrayIndexFilter)path.Filters[0]).Index);
Assert.AreEqual(0, ((ArrayIndexFilter)path.Filters[1]).Index);
Assert.AreEqual(0, ((ArrayIndexFilter)path.Filters[2]).Index);
Assert.AreEqual(int.MaxValue, ((ArrayIndexFilter)path.Filters[3]).Index);
}
示例3: SingleQuotedPropertyWithBrackets
public void SingleQuotedPropertyWithBrackets()
{
JPath path = new JPath("['[*]']");
Assert.AreEqual(1, path.Filters.Count);
Assert.AreEqual("[*]", ((FieldFilter)path.Filters[0]).Name);
}
示例4: MultipleQuotedIndexesWithWhitespace
public void MultipleQuotedIndexesWithWhitespace()
{
JPath path = new JPath("[ '111119990' , '3' ]");
Assert.AreEqual(1, path.Filters.Count);
Assert.AreEqual(2, ((FieldMultipleFilter)path.Filters[0]).Names.Count);
Assert.AreEqual("111119990", ((FieldMultipleFilter)path.Filters[0]).Names[0]);
Assert.AreEqual("3", ((FieldMultipleFilter)path.Filters[0]).Names[1]);
}
示例5: SlicingIndexEmptyStart
public void SlicingIndexEmptyStart()
{
JPath path = new JPath("[ : 1 : ]");
Assert.AreEqual(1, path.Filters.Count);
Assert.AreEqual(null, ((ArraySliceFilter)path.Filters[0]).Start);
Assert.AreEqual(1, ((ArraySliceFilter)path.Filters[0]).End);
Assert.AreEqual(null, ((ArraySliceFilter)path.Filters[0]).Step);
}
示例6: MultiplePropertiesAndIndexers
public void MultiplePropertiesAndIndexers()
{
JPath path = new JPath("Blah[0]..Two.Three[1].Four");
Assert.AreEqual(6, path.Filters.Count);
Assert.AreEqual("Blah", ((FieldFilter) path.Filters[0]).Name);
Assert.AreEqual(0, ((ArrayIndexFilter) path.Filters[1]).Index);
Assert.AreEqual("Two", ((ScanFilter)path.Filters[2]).Name);
Assert.AreEqual("Three", ((FieldFilter)path.Filters[3]).Name);
Assert.AreEqual(1, ((ArrayIndexFilter)path.Filters[4]).Index);
Assert.AreEqual("Four", ((FieldFilter)path.Filters[5]).Name);
}
示例7: IndexerOnlyWithWhitespace
public void IndexerOnlyWithWhitespace()
{
JPath path = new JPath("[ 10 ]");
Assert.AreEqual(1, path.Filters.Count);
Assert.AreEqual(10, ((ArrayIndexFilter)path.Filters[0]).Index);
}
示例8: SinglePropertyAndExistsQuery
public void SinglePropertyAndExistsQuery()
{
JPath path = new JPath("Blah[ ?( @..name ) ]");
Assert.AreEqual(2, path.Filters.Count);
Assert.AreEqual("Blah", ((FieldFilter)path.Filters[0]).Name);
BooleanQueryExpression expressions = (BooleanQueryExpression)((QueryFilter)path.Filters[1]).Expression;
Assert.AreEqual(QueryOperator.Exists, expressions.Operator);
Assert.AreEqual(1, expressions.Path.Count);
Assert.AreEqual("name", ((ScanFilter)expressions.Path[0]).Name);
}
示例9: SinglePropertyAndFilterWithDoubleEscape
public void SinglePropertyAndFilterWithDoubleEscape()
{
JPath path = new JPath(@"Blah[ ?( @.name=='h\\i' ) ]");
Assert.AreEqual(2, path.Filters.Count);
Assert.AreEqual("Blah", ((FieldFilter)path.Filters[0]).Name);
BooleanQueryExpression expressions = (BooleanQueryExpression)((QueryFilter)path.Filters[1]).Expression;
Assert.AreEqual(QueryOperator.Equals, expressions.Operator);
Assert.AreEqual("h\\i", (string)expressions.Value);
}
示例10: OnePropertyOneScan
public void OnePropertyOneScan()
{
JPath path = new JPath("Blah..Two");
Assert.AreEqual(2, path.Filters.Count);
Assert.AreEqual("Blah", ((FieldFilter)path.Filters[0]).Name);
Assert.AreEqual("Two", ((ScanFilter)path.Filters[1]).Name);
}
示例11: SinglePropertyAndIndexer
public void SinglePropertyAndIndexer()
{
JPath path = new JPath("Blah[0]");
Assert.AreEqual(2, path.Filters.Count);
Assert.AreEqual("Blah", ((FieldFilter)path.Filters[0]).Name);
Assert.AreEqual(0, ((ArrayIndexFilter)path.Filters[1]).Index);
}
示例12: TwoProperties
public void TwoProperties()
{
JPath path = new JPath("Blah.Two");
Assert.AreEqual(2, path.Filters.Count);
Assert.AreEqual("Blah", ((FieldFilter)path.Filters[0]).Name);
Assert.AreEqual("Two", ((FieldFilter)path.Filters[1]).Name);
}
示例13: WildcardScanWithRootWithWhitespace
public void WildcardScanWithRootWithWhitespace()
{
JPath path = new JPath("$..* ");
Assert.AreEqual(1, path.Filters.Count);
Assert.AreEqual(null, ((ScanFilter)path.Filters[0]).Name);
}
示例14: SingleScanWithRoot
public void SingleScanWithRoot()
{
JPath path = new JPath("$..Blah");
Assert.AreEqual(1, path.Filters.Count);
Assert.AreEqual("Blah", ((ScanFilter)path.Filters[0]).Name);
}
示例15: SingleProperty
public void SingleProperty()
{
JPath path = new JPath("Blah");
Assert.AreEqual(1, path.Filters.Count);
Assert.AreEqual("Blah", ((FieldFilter)path.Filters[0]).Name);
}