Exemple #1
0
 public void DeleteLocationVertices()
 {
     using (SessionNoServer session = new SessionNoServer(systemDir, 5000, false, true))
     {
         session.BeginUpdate();
         Graph g = Graph.Open(session); // it takes a while to open graph fresh from databases
         if (g != null)
         {
             VertexType userType             = g.FindVertexType("User");
             VertexType locationType         = g.FindVertexType("Location");
             EdgeType   friendEdgeType       = g.FindEdgeType("Friend");
             EdgeType   userLocationEdgeType = g.FindEdgeType("UserLocation");
             for (int i = 1; i < numberOfLocationVertices; i++)
             {
                 locationType.RemoveVertex(new Vertex(g, locationType, i));
             }
             Assert.IsTrue(userLocationEdgeType.CountEdges() == 0);
             Assert.IsTrue(userType.GetEdges(userLocationEdgeType, Direction.Out).Count() == 0);
             session.Commit();
             Validate();
         }
     }
 }