示例#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);
        }
示例#2
0
        public void ProveMapper <TItemOne, TItemTwo, TEdgeOne, TEdgeTwo>(
            IGraph <TItemOne, TEdgeOne> source, IGraph <TItemTwo, TEdgeTwo> target,
            GraphMapper <TItemOne, TItemTwo, TEdgeOne, TEdgeTwo> mapper)
            where TEdgeOne : IEdge <TItemOne>, TItemOne
            where TEdgeTwo : IEdge <TItemTwo>, TItemTwo
        {
            var testerOne = new MapperTester <TItemOne, TItemTwo, TEdgeOne, TEdgeTwo>();

            mapper.ConvertSinkSource();

            testerOne.ProveConversion(source, target, mapper.Get);

            //mapper.Clear();
            mapper.ConvertSourceSink();
            var testerTwo = new MapperTester <TItemTwo, TItemOne, TEdgeTwo, TEdgeOne>();

            testerTwo.ProveConversion(target, source, mapper.Get);
        }