Beispiel #1
0
        public void TestGraphPair(ISampleGraphFactory <IGraphEntity, IGraphEdge> source, ThingGraph target)
        {
            source.Count = 10;
            source.Populate();
            this.ReportDetail(source.GetType().FullName + "\t" + source.Count);

            var graphPair =
                new HollowGraphPair <IGraphEntity, IThing, IGraphEdge, ILink> (
                    source.Graph,
                    target,
                    new GraphEntity2ThingTransformer());

            var mapper = graphPair.Mapper;

            mapper.ConvertSinkSource();

            var convertionTesterOne = new MapperTester <IGraphEntity, IThing, IGraphEdge, ILink> ();

            mapper.ConvertSinkSource();
            convertionTesterOne.ProveConversion(graphPair.Sink, graphPair.Source, mapper.Get);

            var newEntity = new GraphEntity <string> ("new");

            graphPair.Add(newEntity);
            convertionTesterOne.ProveConversion(graphPair.Sink, graphPair.Source, mapper.Get);
        }
Beispiel #2
0
        public virtual void StorePerformanceTest()
        {
            var target    = this.Graph;
            var graphPair = new HollowGraphPair <IGraphEntity, IThing, IGraphEdge, ILink>(
                new Limaki.Graphs.Graph <IGraphEntity, IGraphEdge>(),
                target,
                new GraphEntity2ThingTransformer());

            var factory = new EntityBinaryGraphFactory();

            factory.Graph      = graphPair;
            factory.Count      = RepeatCount;
            factory.AddDensity = true;

            this.Tickers.Start();
            factory.Populate();
            ReportSummary(factory.Name + "\t" + (factory.Graph.Count));
            this.OnFlush(target);

            ReportSummary();
            this.Close();
        }
Beispiel #3
0
        public virtual void ProgramminglanguageJavaDeleteTest2()
        {
            var target = this.Graph;

            var factory = new ThingEntityGraphFactory <EntityProgrammingLanguageFactory>();

            factory.Populate(target);

            var testThing  = factory.Nodes[3]; // Java
            var testThing2 = factory.Nodes[7]; // List
            var testThing3 = factory.Edges[1]; // Programming->Language
            var testThing4 = factory.Nodes[1]; // Programming

            var pair = new HollowGraphPair <IGraphEntity, IThing, IGraphEdge, ILink> (
                new Limaki.Graphs.Graph <IGraphEntity, IGraphEdge> (),
                target,
                new GraphEntity2ThingTransformer()
                );

            pair.Mapper.ConvertSourceSink();

            var testEntity = pair.Get(testThing);
            var testItem4  = pair.Get(testThing4);

            Assert.IsTrue(target.Contains(testThing));

            var deleteCollection =
                new List <IGraphEdge>(pair.PostorderTwig(testEntity));

            foreach (var link in deleteCollection)  // Java
            {
                pair.Remove(link);
            }

            pair.Remove(testEntity); // Java


            foreach (var link in deleteCollection)  // Java
            {
                pair.Remove(link);
            }

            pair.Remove(testEntity); // Java

            foreach (var item in pair.Source.Walk().DeepWalk(testThing4, 0))
            {
                var thing = item.Node;
                Assert.AreNotEqual(thing, testThing);
                if (thing is ILink)
                {
                    var link = (ILink)thing;
                    Assert.AreNotEqual(link.Root, testThing);
                    Assert.AreNotEqual(link.Leaf, testThing);
                }
            }


            foreach (var item in pair.Walk().DeepWalk(testItem4, 0))
            {
                var thing = item.Node;
                Assert.AreNotEqual(thing, testEntity);
                if (thing is IGraphEdge)
                {
                    var link = (IGraphEdge)thing;
                    Assert.AreNotEqual(link.Root, testEntity);
                    Assert.AreNotEqual(link.Leaf, testEntity);
                }
            }
            ReportSummary();
        }