public void TestWhereWithOrStatement() { IGraphClient client = new TestGraphClient(); var q = client .From <User>() .Where(a => a.FirstName.Equals("kalle") && (a.LastName == "Sven" || a.Age > 3)) .BuildGremlinQuery(); Assert.AreEqual("g.V().has('label','User').has('FirstName', 'kalle').has('LastName', 'Sven').has('Age', gt(3))", q); }
public void TestWhereWithEqual() { IGraphClient client = new TestGraphClient(); var q = client .From <User>() .Where(a => a.FirstName.Equals("kalle")) .BuildGremlinQuery(); Assert.AreEqual("g.V().has('label','User').has('FirstName', 'kalle')", q); }
public void TestWhereInSelector() { IGraphClient client = new TestGraphClient(); var q = client .From <User>() .WhereIn(a => a.FirstName, new string[] { "test1", "test2" }) .BuildGremlinQuery(); Assert.AreEqual("g.V().has('label','User').has('FirstName',within('test1','test2'))", q); }
public void TestCountWithoutFilter() { IGraphClient client = new TestGraphClient(); var query = client .From <User>() .Count() .BuildGremlinQuery(); Assert.AreEqual("g.V().has('label','User').count()", query); }
public void TestCountWithFilter() { IGraphClient client = new TestGraphClient(); var query = client .From <User>() .Where(a => a.FirstName == "asdf") .Count() .BuildGremlinQuery(); Assert.AreEqual("g.V().has('label','User').has('FirstName', 'asdf').count()", query); }
public void TestAddOut() { IGraphClient client = new TestGraphClient(); var Login = new Login() { Id = "asdf" }; var query = client .From <User>() .Where(a => a.Id == "123") .AddOut(Login, "has") .BuildGremlinQuery(); Assert.AreEqual("g.V().has('label','User').has('Id', '123').addE('has').to(g.addV('Login').property('Id', 'asdf')).inV()", query); }
public void TestEdgeSelection() { IGraphClient client = new TestGraphClient(); var result = client .From <User>() .Where(a => a.FirstName == "name") .Where(a => a.Id == "id") .Where(a => a.Age == 3) .SelectOut <Login>("has") .BuildGremlinQuery(); Console.WriteLine(result); Assert.AreEqual( "g.V().has('label','User').has('FirstName', 'name').has('Id', 'id').has('Age', 3).out('has').hasLabel('Login')", result); }