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

C# CypherFluentQuery类代码示例

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

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



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

示例1: MultipleMatchClausesWithPairedWhereClauses

        public void MultipleMatchClausesWithPairedWhereClauses()
        {
            // MATCH (n)
            // WHERE n.Foo = {p0}
            // OPTIONAL MATCH (n)--(x)
            // WHERE x.Bar = {p1}
            // OPTIONAL MATCH (x)--(a)
            // WHERE a.Baz = {p2}
            // RETURN n, x

            var client = Substitute.For<IRawGraphClient>();
            var query = new CypherFluentQuery(client)
                .Match("(n)")
                .Where((FooBarBaz n) => n.Foo == "abc")
                .OptionalMatch("(n)--(x)")
                .Where((FooBarBaz x) => x.Bar == "def")
                .OptionalMatch("(x)--(a)")
                .Where((FooBarBaz a) => a.Baz == "ghi")
                .Query;

            const string expected = "MATCH (n)\r\nWHERE (n.Foo = {p0})\r\nOPTIONAL MATCH (n)--(x)\r\nWHERE (x.Bar = {p1})\r\nOPTIONAL MATCH (x)--(a)\r\nWHERE (a.Baz = {p2})";

            Assert.AreEqual(expected, query.QueryText);
            Assert.AreEqual(3, query.QueryParameters.Count());
        }
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:25,代码来源:CypherFluentQueryMatchTests.cs


示例2: ThrowsInvalidOperationException_WhenClientVersionIsLessThan_30

        public void ThrowsInvalidOperationException_WhenClientVersionIsLessThan_30()
        {
            var client = GraphClient_30;
            client.CypherCapabilities.Returns(CypherCapabilities.Cypher23);

            Assert.Throws<InvalidOperationException>(() => { var query = new CypherFluentQuery(client).Yield("uuid").Query; });
        }
开发者ID:Readify,项目名称:Neo4jClient,代码行数:7,代码来源:CypherFluentQueryYieldTests.cs


示例3: ThrowsExceptionWhenUriIsNull

        public void ThrowsExceptionWhenUriIsNull()
        {
            var client = Substitute.For<IRawGraphClient>();
            var query = new CypherFluentQuery(client);

            Assert.Throws<ArgumentException>(() => query.LoadCsv(null, "row"));
        }
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:7,代码来源:CypherFluentQueryLoadCsvTests.cs


示例4: UsesJsonPropertyNameOverPropertyName

        public void UsesJsonPropertyNameOverPropertyName()
        {
            var client = Substitute.For<IRawGraphClient>();
            var query = new CypherFluentQuery(client).Where((FooWithJsonProperties foo) => foo.Bar == "Bar").Query;

            Assert.AreEqual("WHERE (foo.bar = {p0})", query.QueryText);
        }
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:7,代码来源:CypherFluentQueryWhereTests.cs


示例5: SetupGraphClient

 public CypherExtensionTestHelper SetupGraphClient()
 {
     GraphClient = new Mock<IRawGraphClient>();
     GraphClient.Setup(x => x.JsonContractResolver).Returns(new DefaultContractResolver());
     Query = new CypherFluentQuery(GraphClient.Object);
     return this;
 }
开发者ID:larsw,项目名称:Neo4jClient.Extension,代码行数:7,代码来源:CypherExtensionTests.cs


示例6: ExecutingQueryMultipleTimesShouldResetParameters

        public void ExecutingQueryMultipleTimesShouldResetParameters()
        {
            var client = Substitute.For<IRawGraphClient>();

            client
                .ExecuteGetCypherResults<ReturnPropertyQueryResult>(Arg.Any<CypherQuery>())
                .Returns(Enumerable.Empty<ReturnPropertyQueryResult>());

            var cypher = new CypherFluentQuery(client);
            var query1 = cypher
                .Start("a", (NodeReference)1)
                .Return<object>("a.Name")
                .Query;

            Assert.AreEqual(1, query1.QueryParameters.Count());
            Assert.AreEqual(1, query1.QueryParameters["p0"]);

            var query2 = cypher
                .Start("b", (NodeReference)2)
                .Return<object>("a.Name")
                .Query;

            Assert.AreEqual(1, query2.QueryParameters.Count());
            Assert.AreEqual(2, query2.QueryParameters["p0"]);
        }
开发者ID:Winsto,项目名称:Neo4jClient,代码行数:25,代码来源:CypherFluentQueryResultsTests.cs


示例7: ComplexObjectInWithParam

        public void ComplexObjectInWithParam()
        {
            // Arrange
            var client = Substitute.For<IRawGraphClient>();

            // Act
            var query = new CypherFluentQuery(client)
                .Start("n", (NodeReference) 3)
                .CreateUnique("n-[:X]-(leaf {obj})")
                .WithParam("obj", new ComplexObjForWithParamTest
                                  {
                                      Id = 123,
                                      Name = "Bar",
                                      Currency = (decimal) 12.143
                                  })
                .Query;

            // Assert
            Assert.AreEqual("START n=node(3)" +
                            "\r\nCREATE UNIQUE n-[:X]-(leaf {" +
                            "\r\n  \"Id\": 123," +
                            "\r\n  \"Name\": \"Bar\"," +
                            "\r\n  \"Currency\": 12.143" +
                            "\r\n})", query.DebugQueryText);
            Assert.AreEqual(2, query.QueryParameters.Count);
        }
开发者ID:veshu,项目名称:Neo4jClient,代码行数:26,代码来源:CypherFluentQueryWithParamTests.cs


示例8: ThrowInvalidOperationException_WhenAttemptingToDeleteProperty

 public void ThrowInvalidOperationException_WhenAttemptingToDeleteProperty()
 {
     var client = GraphClient_230;
     var query = new CypherFluentQuery(client)
         .DetachDelete("andres.age")
         .Return<Node<object>>("andres")
         .Query;
 }
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:8,代码来源:CypherFluentQueryDetachDeleteTests.cs


示例9: ThrowArgumentException_WhenNoStoredProcedureIsGiven

 public void ThrowArgumentException_WhenNoStoredProcedureIsGiven()
 {
     var client = GraphClient_30;
     Assert.Throws<ArgumentException>(() =>
     {
         var query = new CypherFluentQuery(client).Yield(null).Query;
     });
 }
开发者ID:Readify,项目名称:Neo4jClient,代码行数:8,代码来源:CypherFluentQueryYieldTests.cs


示例10: TestUnwindConstruction

        public void TestUnwindConstruction()
        {
            var client = Substitute.For<IRawGraphClient>();
            var query = new CypherFluentQuery(client)
                .Unwind("collection", "column")
                .Query;

            Assert.AreEqual("UNWIND collection AS column", query.QueryText);
        }
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:9,代码来源:CypherFluentQueryUnwindTests.cs


示例11: ShouldReturnSpecificPropertyTakingIntoAccountJsonProperty

        public void ShouldReturnSpecificPropertyTakingIntoAccountJsonProperty()
        {
            var client = Substitute.For<IRawGraphClient>();
            var query = new CypherFluentQuery(client)
                .With(a => a.As<Cypher.FooWithJsonProperties>().Bar)
                .Query;

            Assert.AreEqual("WITH a.bar", query.QueryText);
        }
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:9,代码来源:CypherFluentQueryWithTests.cs


示例12: CallsStoredProcedureGiven

        public void CallsStoredProcedureGiven()
        {
            var client = GraphClient_30;
            var query = new CypherFluentQuery(client)
                .Call("apoc.sp()")
                .Query;

            Assert.AreEqual("CALL apoc.sp()", query.QueryText);
        }
开发者ID:Readify,项目名称:Neo4jClient,代码行数:9,代码来源:CypherFluentQueryCallTests.cs


示例13: ShouldReturnSpecificPropertyOnItsOwn

        public void ShouldReturnSpecificPropertyOnItsOwn()
        {
            var client = Substitute.For<IRawGraphClient>();
            var query = new CypherFluentQuery(client)
                .With(a => a.As<Commodity>().Name)
                .Query;

            Assert.AreEqual("WITH a.Name", query.QueryText);
        }
开发者ID:Russe11,项目名称:Neo4jClient,代码行数:9,代码来源:CypherFluentQueryWithTests.cs


示例14: ShouldTranslateAnonymousObjectWithImplicitPropertyNames

        public void ShouldTranslateAnonymousObjectWithImplicitPropertyNames()
        {
            var client = Substitute.For<IRawGraphClient>();
            var query = new CypherFluentQuery(client)
                .With(a => new { a })
                .Query;

            Assert.AreEqual("WITH a", query.QueryText);
        }
开发者ID:Russe11,项目名称:Neo4jClient,代码行数:9,代码来源:CypherFluentQueryWithTests.cs


示例15: ShouldReturnCountOnItsOwn

        public void ShouldReturnCountOnItsOwn()
        {
            var client = Substitute.For<IRawGraphClient>();
            var query = new CypherFluentQuery(client)
                .With(item => item.Count())
                .Query;

            Assert.AreEqual("WITH count(item)", query.QueryText);
        }
开发者ID:Russe11,项目名称:Neo4jClient,代码行数:9,代码来源:CypherFluentQueryWithTests.cs


示例16: ShouldReturnCustomFunctionCall

        public void ShouldReturnCustomFunctionCall()
        {
            var client = Substitute.For<IRawGraphClient>();
            var query = new CypherFluentQuery(client)
                .With(() => new { baz = "sum(foo.bar)" })
                .Query;

            Assert.AreEqual("WITH sum(foo.bar) AS baz", query.QueryText);
        }
开发者ID:Russe11,项目名称:Neo4jClient,代码行数:9,代码来源:CypherFluentQueryWithTests.cs


示例17: ThrowsInvalidOperationException_WhenNeo4jVersionIsLessThan22

        public void ThrowsInvalidOperationException_WhenNeo4jVersionIsLessThan22()
        {
            var client = Substitute.For<IRawGraphClient>();
            client.CypherCapabilities.Returns(CypherCapabilities.Cypher19);

            var _ = new CypherFluentQuery(client)
                .Planner("FreePlanner")
                .Query;
        }
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:9,代码来源:CypherFluentQueryPlannerTests.cs


示例18: YieldsGivenText

        public void YieldsGivenText()
        {
            var client = GraphClient_30;
            var query = new CypherFluentQuery(client)
                .Yield("uuid")
                .Query;

            Assert.AreEqual("YIELD uuid", query.QueryText);
        }
开发者ID:Readify,项目名称:Neo4jClient,代码行数:9,代码来源:CypherFluentQueryYieldTests.cs


示例19: BinaryExpressionIsNull

        public void BinaryExpressionIsNull()
        {
            var client = Substitute.For<IRawGraphClient>();
            var query = new CypherFluentQuery(client)
                .Match("(a)")
                .Return(a => new { IsNull = a == null })
                .Query;

            Assert.AreEqual("MATCH (a)\r\nRETURN a IS NULL AS IsNull", query.QueryText);
        }
开发者ID:Russe11,项目名称:Neo4jClient,代码行数:10,代码来源:CypherFluentQueryReturnTests.cs


示例20: ShouldReturnSpecificPropertyOnItsOwnCamelAs

        public void ShouldReturnSpecificPropertyOnItsOwnCamelAs()
        {
            var client = Substitute.For<IRawGraphClient>();
            client.JsonContractResolver = new CamelCasePropertyNamesContractResolver();
            var query = new CypherFluentQuery(client)
                .With(a => new Commodity(){ Name = a.As<Commodity>().Name})
                .Query;

            Assert.AreEqual("WITH a.name? AS Name", query.QueryText);
        }
开发者ID:Winsto,项目名称:Neo4jClient,代码行数:10,代码来源:CypherFluentQueryWithTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# D3类代码示例发布时间:2022-05-24
下一篇:
C# Cylinder类代码示例发布时间: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