示例#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);
        }
 public SampleGraphPairFactory(
     ISampleGraphFactory <TSourceItem, TSourceEdge> factory,
     GraphItemTransformer <TSinkItem, TSourceItem, TSinkEdge, TSourceEdge> transformer)
 {
     this._factory     = factory;
     this._transformer = transformer;
     this._mapper      =
         new GraphMapper <TSinkItem, TSourceItem, TSinkEdge, TSourceEdge> (Transformer);
 }
示例#3
0
        protected ISampleGraphFactory <TItem, TEdge> Innerfactory(ISampleGraphFactory <IVisual, IVisualEdge> factory)
        {
            var p = factory as SampleGraphPairFactory <IVisual, TItem, IVisualEdge, TEdge>;

            if (p != null)
            {
                return(p.Factory);
            }
            return(null);
        }
示例#4
0
        public void ProveSample(ISampleGraphFactory <IGraphEntity, IGraphEdge> data)
        {
            data.Count = 10;
            data.Populate();
            this.ReportDetail(data.GetType().FullName + "\t" + data.Count);

            var thingGraph = new ThingGraph();
            var mapper     =
                new GraphMapper <IGraphEntity, IThing, IGraphEdge, ILink>(
                    data.Graph, thingGraph, new GraphEntity2ThingTransformer());

            ProveMapper <IGraphEntity, IThing, IGraphEdge, ILink>(data.Graph, thingGraph, mapper);
        }
示例#5
0
        public IGraphPair <IGraphEntity, IThing, IGraphEdge, ILink> MakeGraphPair(
            ISampleGraphFactory <IGraphEntity, IGraphEdge> source, ThingGraph target)
        {
            source.Count = 10;
            source.Populate();

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

            mapper.ConvertSinkSource();

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

            return(graphPair);
        }