Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 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));
 }
Esempio n. 5
0
        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);
        }
Esempio n. 7
0
        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);
        }