Example #1
0
 public void Predicates_Within()
 {
     using (var client = TestDatabase.GetClient("predicates_within"))
     {
         int[] empty     = { };
         int[] values    = { age };
         int[] outValues = { age + 1 };
         client.Execute(VertexQuery.Create("test").AddProperty("age", 30)).Wait();
         Assert.ThrowsException <ArgumentException>(() => { GraphPredicate.Within(empty); });
         Assert.AreEqual(1, client.Execute(VertexQuery.All().Values("age").Is(GraphPredicate.Within(values))).Result.Count());
         Assert.AreEqual(0, client.Execute(VertexQuery.All().Values("age").Is(GraphPredicate.Within(outValues))).Result.Count());
     }
 }
Example #2
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);
     }
 }