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


C# CypherFluentQuery.Start方法代码示例

本文整理汇总了C#中CypherFluentQuery.Start方法的典型用法代码示例。如果您正苦于以下问题:C# CypherFluentQuery.Start方法的具体用法?C# CypherFluentQuery.Start怎么用?C# CypherFluentQuery.Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CypherFluentQuery的用法示例。


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

示例1: 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

示例2: AddingStartBitsToDifferentQueriesShouldntCorruptEachOther

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

            var query1 = cypher
                .Start("a", (NodeReference)1)
                .Query;

            var query2 = cypher
                .Start("b", (NodeReference)2)
                .Query;

            Assert.AreEqual("START a=node({p0})", query1.QueryText);
            Assert.AreEqual(1, query1.QueryParameters.Count);
            Assert.AreEqual(1, query1.QueryParameters["p0"]);

            Assert.AreEqual("START b=node({p0})", query2.QueryText);
            Assert.AreEqual(1, query2.QueryParameters.Count);
            Assert.AreEqual(2, query2.QueryParameters["p0"]);
        }
开发者ID:Russe11,项目名称:Neo4jClient,代码行数:21,代码来源:CypherFluentQueryTests.cs

示例3: ReturnNodeAsSet

        public void ReturnNodeAsSet()
        {
            var client = Substitute.For<IRawGraphClient>();
            var set = new[] { new Node<FooNode>(new FooNode(), new NodeReference<FooNode>(123)) };
            client
                .ExecuteGetCypherResults<Node<FooNode>>(
                    Arg.Is<CypherQuery>(q => q.ResultMode == CypherResultMode.Set))
                .Returns(set);

            var cypher = new CypherFluentQuery(client);
            var results = cypher
                .Start("a", (NodeReference)1)
                .Return<Node<FooNode>>("a")
                .Results;

            CollectionAssert.AreEqual(set, results);
        }
开发者ID:KodrAus,项目名称:Neo4jClient,代码行数:17,代码来源:CypherFluentQueryResultsTests.cs

示例4: ReturnColumnAlias

        public void ReturnColumnAlias()
        {
            // http://docs.neo4j.org/chunked/1.6/query-return.html#return-column-alias
            // START a=node(1)
            // RETURN a.Age AS SomethingTotallyDifferent

            var client = Substitute.For<IRawGraphClient>();

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

            var cypher = new CypherFluentQuery(client);
            var results = cypher
                .Start("a", (NodeReference)1)
                .Return(a => new ReturnPropertyQueryResult
                {
                    SomethingTotallyDifferent = a.As<FooNode>().Age,
                })
                .Results;

            Assert.IsInstanceOf<IEnumerable<ReturnPropertyQueryResult>>(results);
        }
开发者ID:Winsto,项目名称:Neo4jClient,代码行数:23,代码来源:CypherFluentQueryResultsTests.cs

示例5: ReturnColumnAlias

        public void ReturnColumnAlias()
        {
            // http://docs.neo4j.org/chunked/1.6/query-return.html#return-column-alias
            // START a=node(1)
            // RETURN a.Age AS SomethingTotallyDifferent

            var client = Substitute.For<IRawGraphClient>();

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

            var cypher = new CypherFluentQuery(client);
            var results = cypher
                .Start("a", (NodeReference) 1)
                .Advanced.Return<ReturnPropertyQueryResult>(new ReturnExpression
                {
                    ResultFormat = CypherResultFormat.DependsOnEnvironment,
                    ResultMode = CypherResultMode.Projection,
                    Text = "a.Age AS SomethingTotallyDifferent"
                });
            Assert.AreEqual("START a=node(1)\r\nRETURN a.Age AS SomethingTotallyDifferent", results.Query.DebugQueryText);
            Assert.IsInstanceOf<IEnumerable<ReturnPropertyQueryResult>>(results.Results);
        }
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:24,代码来源:CypherFluentQueryAdvancedTests.cs

示例6: ReturnRelationshipWithDataAsSet

        public void ReturnRelationshipWithDataAsSet()
        {
            var client = Substitute.For<IRawGraphClient>();
            var set = new[] { new RelationshipInstance<FooNode>(new RelationshipReference<FooNode>(1), new NodeReference(0), new NodeReference(2),"Type", new FooNode()) };
            client
                .ExecuteGetCypherResults<RelationshipInstance<FooNode>>(
                    Arg.Is<CypherQuery>(q => q.ResultMode == CypherResultMode.Set))
                .Returns(set);

            var cypher = new CypherFluentQuery(client);
            var results = cypher
                .Start("a", (RelationshipReference)1)
                .Return<RelationshipInstance<FooNode>>("a")
                .Results;

            CollectionAssert.AreEqual(set, results);
        }
开发者ID:Winsto,项目名称:Neo4jClient,代码行数:17,代码来源:CypherFluentQueryResultsTests.cs


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