本文整理汇总了C#中CypherFluentQuery类的典型用法代码示例。如果您正苦于以下问题:C# CypherFluentQuery类的具体用法?C# CypherFluentQuery怎么用?C# CypherFluentQuery使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CypherFluentQuery类属于命名空间,在下文中一共展示了CypherFluentQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例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; });
}
示例3: ThrowsExceptionWhenUriIsNull
public void ThrowsExceptionWhenUriIsNull()
{
var client = Substitute.For<IRawGraphClient>();
var query = new CypherFluentQuery(client);
Assert.Throws<ArgumentException>(() => query.LoadCsv(null, "row"));
}
示例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);
}
示例5: SetupGraphClient
public CypherExtensionTestHelper SetupGraphClient()
{
GraphClient = new Mock<IRawGraphClient>();
GraphClient.Setup(x => x.JsonContractResolver).Returns(new DefaultContractResolver());
Query = new CypherFluentQuery(GraphClient.Object);
return this;
}
示例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"]);
}
示例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);
}
示例8: ThrowInvalidOperationException_WhenAttemptingToDeleteProperty
public void ThrowInvalidOperationException_WhenAttemptingToDeleteProperty()
{
var client = GraphClient_230;
var query = new CypherFluentQuery(client)
.DetachDelete("andres.age")
.Return<Node<object>>("andres")
.Query;
}
示例9: ThrowArgumentException_WhenNoStoredProcedureIsGiven
public void ThrowArgumentException_WhenNoStoredProcedureIsGiven()
{
var client = GraphClient_30;
Assert.Throws<ArgumentException>(() =>
{
var query = new CypherFluentQuery(client).Yield(null).Query;
});
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}