• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# JPath类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中JPath的典型用法代码示例。如果您正苦于以下问题:C# JPath类的具体用法?C# JPath怎么用?C# JPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JPath类属于命名空间,在下文中一共展示了JPath类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: SinglePropertyAndFilterWithNull

 public void SinglePropertyAndFilterWithNull()
 {
     JPath path = new JPath("Blah[ ?( @.name==null ) ]");
     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(null, expressions.Value.Value);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:9,代码来源:JPathParseTests.cs


示例17: FilterWithFloatExp

 public void FilterWithFloatExp()
 {
     JPath path = new JPath("[?(@.name>=5.56789e+0)]");
     BooleanQueryExpression expressions = (BooleanQueryExpression)((QueryFilter)path.Filters[0]).Expression;
     Assert.AreEqual(5.56789e+0, (double)expressions.Value);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:6,代码来源:JPathParseTests.cs


示例18: FilterWithScan

 public void FilterWithScan()
 {
     JPath path = new JPath("[?(@..name<>null)]");
     BooleanQueryExpression expressions = (BooleanQueryExpression)((QueryFilter)path.Filters[0]).Expression;
     Assert.AreEqual("name", ((ScanFilter)expressions.Path[0]).Name);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:6,代码来源:JPathParseTests.cs


示例19: IndexerOnly

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


示例20: FilterWithLessThan

 public void FilterWithLessThan()
 {
     JPath path = new JPath("[?(@.name<null)]");
     BooleanQueryExpression expressions = (BooleanQueryExpression)((QueryFilter)path.Filters[0]).Expression;
     Assert.AreEqual(QueryOperator.LessThan, expressions.Operator);
 }
开发者ID:925coder,项目名称:Newtonsoft.Json,代码行数:6,代码来源:JPathParseTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# JSBinaryOperatorExpression类代码示例发布时间:2022-05-24
下一篇:
C# JObject类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap