Beispiel #1
0
        public void testSingleProperty()
        {
            var _Graph = TinkerGraphFactory.CreateTinkerGraph();
            var _Marko = _Graph.VertexById(1);

            var _PPipe = new PropertyPipe<String, Object>(Keys: "name");

            _PPipe.SetSource(new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
                                                             UInt64, Int64, String, String, Object,
                                                             UInt64, Int64, String, String, Object,
                                                             UInt64, Int64, String, String, Object>>() { _Marko }.GetEnumerator());

            var _Counter = 0;
            while (_PPipe.MoveNext())
            {
                var name = _PPipe.Current;
                Assert.AreEqual("marko", name);
                _Counter++;
            }
        }
Beispiel #2
0
        public void testPathConstruction()
        {
            var _Graph = TinkerGraphFactory.CreateTinkerGraph();

            var _Marko = _Graph.VertexById(1);

            var _Pipe1 = new OutEdgesPipe<UInt64, Int64, String, String, Object,
                                          UInt64, Int64, String, String, Object,
                                          UInt64, Int64, String, String, Object,
                                          UInt64, Int64, String, String, Object>();

            var _Pipe2 = new InVertexPipe<UInt64, Int64, String, String, Object,
                                          UInt64, Int64, String, String, Object,
                                          UInt64, Int64, String, String, Object,
                                          UInt64, Int64, String, String, Object>();

            var _Pipe3 = new PropertyPipe<String, Object>(Keys: "name");

            _Pipe3.SetSource(_Pipe2);
            _Pipe2.SetSource(_Pipe1);

            var _MarkoList = new List<IGenericPropertyVertex<UInt64, Int64, String, String, Object,
                                                             UInt64, Int64, String, String, Object,
                                                             UInt64, Int64, String, String, Object,
                                                             UInt64, Int64, String, String, Object>>() { _Marko };

            _Pipe1.SetSource(_MarkoList.GetEnumerator());

            foreach (var _Name in _Pipe3)
            {

                var path = _Pipe3.Path;

                Assert.AreEqual(_Marko,                 path[0]);
                Assert.AreEqual(typeof(IGenericPropertyEdge<UInt64, Int64, String, String, Object,
                                                            UInt64, Int64, String, String, Object,
                                                            UInt64, Int64, String, String, Object,
                                                            UInt64, Int64, String, String, Object>), path[1].GetType());

                Assert.AreEqual(typeof(IGenericPropertyVertex<UInt64, Int64, String, String, Object,
                                                              UInt64, Int64, String, String, Object,
                                                              UInt64, Int64, String, String, Object,
                                                              UInt64, Int64, String, String, Object>), path[2].GetType());

                Assert.AreEqual(typeof(String),         path[3].GetType());

                if (_Name == "vadas")
                {
                    Assert.AreEqual(_Graph.EdgeById(7),     path[1]);
                    Assert.AreEqual(_Graph.VertexById(2), path[2]);
                    Assert.AreEqual("vadas", path[3]);
                }

                else if (_Name == "lop")
                {
                    Assert.AreEqual(_Graph.EdgeById(9),     path[1]);
                    Assert.AreEqual(_Graph.VertexById(3), path[2]);
                    Assert.AreEqual("lop", path[3]);
                }

                else if (_Name == "josh")
                {
                    Assert.AreEqual(_Graph.EdgeById(8),     path[1]);
                    Assert.AreEqual(_Graph.VertexById(4), path[2]);
                    Assert.AreEqual("josh", path[3]);
                }

                else
                    Assert.Fail();

            }
        }