Example #1
0
 public void Predicates_Without()
 {
     using (var client = TestDatabase.GetClient("predicates_without"))
     {
         int[] empty     = { };
         int[] values    = { age };
         int[] outValues = { age + 1 };
         client.Execute(VertexQuery.Create("test").AddProperty("age", 30)).Wait();
         Assert.ThrowsException <ArgumentException>(() => { GraphPredicate.Without(empty); });
         Assert.AreEqual(0, client.Execute(VertexQuery.All().Values("age").Is(GraphPredicate.Without(values))).Result.Count());
         Assert.AreEqual(1, client.Execute(VertexQuery.All().Values("age").Is(GraphPredicate.Without(outValues))).Result.Count());
     }
 }
Example #2
0
        public void Steps_Aggregate()
        {
            using (var client = TestDatabase.GetClient("aggregate"))
            {
                client.Execute(VertexQuery.Create("test")).Wait();

                var query = VertexQuery.All().Aggregate("x").Where(GraphPredicate.Without(new List <object>()
                {
                    "x"
                }));

                Assert.AreEqual(client.Execute(query).Result.Count(), 0);
            }
        }
Example #3
0
 public void Steps_Has()
 {
     using (var client = TestDatabase.GetClient("has"))
     {
         client.Execute(VertexQuery.Create("foo").AddProperty("key", "value")).Wait();
         Assert.AreEqual(client.Execute(VertexQuery.All().Has("key").Count()).Result.First(), 1L);
         Assert.AreEqual(client.Execute(VertexQuery.All().Has("not_key").Count()).Result.First(), 0L);
         Assert.AreEqual(client.Execute(VertexQuery.All().Has("key", "value").Count()).Result.First(), 1L);
         Assert.AreEqual(client.Execute(VertexQuery.All().Has("not_key", "value").Count()).Result.First(), 0L);
         Assert.AreEqual(client.Execute(VertexQuery.All().Has("key", "not_value").Count()).Result.First(), 0L);
         Assert.AreEqual(client.Execute(VertexQuery.All().Has("foo", "key", "value").Count()).Result.First(), 1L);
         Assert.AreEqual(client.Execute(VertexQuery.All().Has("not_foo", "key", "value").Count()).Result.First(), 0L);
         Assert.AreEqual(client.Execute(VertexQuery.All().Has("key", GraphPredicate.Within(new List <object>()
         {
             "value"
         })).Count()).Result.First(), 1L);
         Assert.AreEqual(client.Execute(VertexQuery.All().Has("key", GraphPredicate.Without(new List <object>()
         {
             "value"
         })).Count()).Result.First(), 0L);
     }
 }