Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public void TestCountWithoutFilter()
        {
            IGraphClient client = new TestGraphClient();
            var          query  = client
                                  .From <User>()
                                  .Count()
                                  .BuildGremlinQuery();

            Assert.AreEqual("g.V().has('label','User').count()", query);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }