本文整理汇总了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"]);
}
示例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"]);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}