当前位置: 首页>>代码示例>>C#>>正文


C# JPath类代码示例

本文整理汇总了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);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:6,代码来源:JPathParseTests.cs

示例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);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:9,代码来源:JPathParseTests.cs

示例3: SingleQuotedPropertyWithBrackets

 public void SingleQuotedPropertyWithBrackets()
 {
     JPath path = new JPath("['[*]']");
     Assert.AreEqual(1, path.Filters.Count);
     Assert.AreEqual("[*]", ((FieldFilter)path.Filters[0]).Name);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:6,代码来源:JPathParseTests.cs

示例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]);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:8,代码来源:JPathParseTests.cs

示例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);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:8,代码来源:JPathParseTests.cs

示例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);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:11,代码来源:JPathParseTests.cs

示例7: IndexerOnlyWithWhitespace

 public void IndexerOnlyWithWhitespace()
 {
     JPath path = new JPath("[  10  ]");
     Assert.AreEqual(1, path.Filters.Count);
     Assert.AreEqual(10, ((ArrayIndexFilter)path.Filters[0]).Index);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:6,代码来源:JPathParseTests.cs

示例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);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:10,代码来源:JPathParseTests.cs

示例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);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:9,代码来源:JPathParseTests.cs

示例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);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:7,代码来源:JPathParseTests.cs

示例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);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:7,代码来源:JPathParseTests.cs

示例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);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:7,代码来源:JPathParseTests.cs

示例13: WildcardScanWithRootWithWhitespace

 public void WildcardScanWithRootWithWhitespace()
 {
     JPath path = new JPath("$..* ");
     Assert.AreEqual(1, path.Filters.Count);
     Assert.AreEqual(null, ((ScanFilter)path.Filters[0]).Name);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:6,代码来源:JPathParseTests.cs

示例14: SingleScanWithRoot

 public void SingleScanWithRoot()
 {
     JPath path = new JPath("$..Blah");
     Assert.AreEqual(1, path.Filters.Count);
     Assert.AreEqual("Blah", ((ScanFilter)path.Filters[0]).Name);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:6,代码来源:JPathParseTests.cs

示例15: SingleProperty

 public void SingleProperty()
 {
     JPath path = new JPath("Blah");
     Assert.AreEqual(1, path.Filters.Count);
     Assert.AreEqual("Blah", ((FieldFilter)path.Filters[0]).Name);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:6,代码来源:JPathParseTests.cs


注:本文中的JPath类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。