Пример #1
0
        public void TestSchema(Schema schema)
        {
            Trace.WriteLine(GraphTestUtils.ReportGraph <IThing, ILink>(
                                schema.SchemaGraph, schema.GetType().FullName + ".Graph"));
            Trace.WriteLine(GraphTestUtils.ReportGraph <IThing, ILink>(
                                Schema.IdentityGraph, "Schema.IdentityGraph"));

            TestIdentity(schema.SchemaGraph);
        }
Пример #2
0
        public void ThingGraphFactory()
        {
            var graph = new VisualThingGraph();

            var factory = new ThingEntityGraphFactory <ProgrammingLanguageFactory <IGraphEntity, IGraphEdge> > ();

            factory.Populate(graph.Source);
            Trace.Write(
                GraphTestUtils.ReportGraph <IThing, ILink> (graph.Source, factory.Name));
        }
Пример #3
0
        public void TestGraphPairFactory()
        {
            IThingGraph thingGraph = new ThingGraph();

            var factory =
                new SampleGraphPairFactory <IThing, IGraphEntity, ILink, IGraphEdge> (
                    new ProgrammingLanguageFactory <IGraphEntity, IGraphEdge> (),
                    new GraphEntity2ThingTransformer().Reverted()
                    );

            factory.Mapper.Sink = thingGraph;
            factory.Populate(thingGraph);

            Trace.Write(
                GraphTestUtils.ReportGraph <IThing, ILink> (thingGraph, factory.Name));
        }
Пример #4
0
        public void FoldingExpandTest()
        {
            var graph = new VisualThingGraph();

            var test = new EntityProgrammingSceneTest();

            test.Mock.SampleFactory.Graph = graph;
            test.Mock.Scene       = new Scene();
            test.Mock.Scene.Graph = graph;

            var factory = new ThingEntityGraphFactory <ProgrammingLanguageFactory <IGraphEntity, IGraphEdge> > ();

            factory.Count = 10;
            factory.Populate(graph.Source);

            test.Mock.SetFocused(graph.Get(factory.Nodes[1]));
            Trace.Write(
                GraphTestUtils.ReportGraph <IVisual, IVisualEdge> (graph.Sink, factory.Name));

            test.Mock.SceneFacade.Expand(false);

            Trace.Write(
                GraphTestUtils.ReportGraph <IVisual, IVisualEdge> (graph.Sink, factory.Name));
        }
Пример #5
0
        public void ValidateTitle(DigidocSchema schema, IThingGraph graph, IThing thing, IThing title)
        {
            Assert.AreSame(schema.Title, title);

            this.ReportDetail(GraphTestUtils.ReportGraph <IThing, ILink>(graph, "* Title added"));
            bool found       = false;
            bool firstMarker = false;

            foreach (ILink link in graph.Edges(thing))
            {
                if (link.Marker == DigidocSchema.DocumentTitle)
                {
                    Assert.IsFalse(firstMarker, "second title found");
                    firstMarker = true;
                }
                if (link.Leaf == schema.Title && link.Marker == DigidocSchema.DocumentTitle &&
                    link.Leaf == title)
                {
                    Assert.IsFalse(found);
                    found = true;
                }
            }
            Assert.IsTrue(found, "Title not found");
        }
Пример #6
0
        public void ValidateDescription(CommonSchema schema, IThingGraph graph, IThing thing, IThing description)
        {
            Assert.AreSame(schema.Description, description);

            this.ReportDetail(GraphTestUtils.ReportGraph <IThing, ILink>(graph, "* Descriptioin added"));
            bool found       = false;
            bool firstMarker = false;

            foreach (ILink link in graph.Edges(thing))
            {
                if (link.Marker == CommonSchema.DescriptionMarker)
                {
                    Assert.IsFalse(firstMarker, "second descriptionmarker found");
                    firstMarker = true;
                }
                if (link.Leaf == schema.Description && link.Marker == CommonSchema.DescriptionMarker &&
                    link.Leaf == description)
                {
                    Assert.IsFalse(found);
                    found = true;
                }
            }
            Assert.IsTrue(found);
        }