private ScenarioData(IDictionary <string, ScenarioDataPerGraph> dataPerGraph) { _dataPerGraph = new Dictionary <string, ScenarioDataPerGraph>(dataPerGraph); var empty = new ScenarioDataPerGraph("empty", ConnectionFactory.CreateRemoteConnection("ggraph"), new Dictionary <string, Vertex>(0), new Dictionary <string, Edge>()); _dataPerGraph.Add("empty", empty); }
public async Task TraversalWithEdgeId_RelationIdentifierReturned_ValidRelationIdentifier() { var g = Traversal().WithRemote(_connectionFactory.CreateRemoteConnection()); var relationIdentifier = await g.V().Has("demigod", "name", "hercules").OutE("father").Id().Promise(t => t.Next()); Assert.IsType <RelationIdentifier>(relationIdentifier); }
public async Task TraversalWithRelationIdentifierAsEdgeId_ExistingEdgeId_EdgeFound() { var g = new Graph().Traversal().WithRemote(_connectionFactory.CreateRemoteConnection()); var edgeId = await g.E().Id().Promise(t => t.Next()); var count = await g.E(edgeId).Count().Promise(t => t.Next()); Assert.Equal(1, count); }
private Dictionary <string, ScenarioDataPerGraph> LoadDataPerGraph() { return(GraphNames.Select(name => { var connection = _connectionFactory.CreateRemoteConnection($"g{name}"); var g = Traversal().WithRemote(connection); return new ScenarioDataPerGraph(name, connection, GetVertices(g), GetEdges(g), GetVertexProperties(g)); }).ToDictionary(x => x.Name)); }
public ScenarioData(IMessageSerializer messageSerializer) { _connectionFactory = new RemoteConnectionFactory(messageSerializer); _dataPerGraph = LoadDataPerGraph(); var empty = new ScenarioDataPerGraph("empty", _connectionFactory.CreateRemoteConnection("ggraph"), new Dictionary <string, Vertex>(0), new Dictionary <string, Edge>(), new Dictionary <string, VertexProperty>()); _dataPerGraph.Add("empty", empty); }
public async Task TraversalWithPointHasFilter_ExistingPoint_ElementFound() { var g = Traversal().WithRemote(_connectionFactory.CreateRemoteConnection()); var count = await g.V().Has("demigod", "name", "hercules").OutE("battled") .Has("place", Geoshape.Point(38.1f, 23.7f)).Count().Promise(t => t.Next()); Assert.Equal(1, count); }
public void ShouldUseDsl() { var connection = _connectionFactory.CreateRemoteConnection(); var social = AnonymousTraversalSource.Traversal().WithRemote(connection); Assert.NotNull(social.Persons("marko").Knows("josh").Next()); Assert.Equal(27, social.Persons("marko").YoungestFriendsAge().Next()); Assert.Equal(4, social.Persons().Count().Next()); Assert.Equal(2, social.Persons("marko", "josh").Count().Next()); Assert.Equal(1, social.Persons().Filter(__Social.CreatedAtLeast(2)).Count().Next()); }
public async Task TraversalWithPointPropertyValue_PointReturned_ExpectedPoint() { var g = Traversal().WithRemote(_connectionFactory.CreateRemoteConnection()); var place = await g.V().Has("demigod", "name", "hercules").OutE("battled").Has("time", 1) .Values <Point>("place").Promise(t => t.Next()); var expectedPlace = Geoshape.Point(38.1f, 23.7f); Assert.Equal(expectedPlace.Latitude, place.Latitude, 3); Assert.Equal(expectedPlace.Longitude, place.Longitude, 3); }