public virtual void DocumentSchemaTest() { var factory = new DigidocSampleFactory(); factory.Graph = this.Graph; factory.Populate(); ((SchemaThingGraph)Graph).Initialize(); TestDescription(factory.Nodes[1], factory.Nodes[2], factory.Edges[1]); TestDescription(factory.Nodes[3], factory.Nodes[4], factory.Edges[3]); ReportSummary(); }
public virtual void TestDocumentWithTestData() { IThingGraph thingGraph = new ThingGraph(); var prov = new Limada.IO.Db4oThingGraphIo(); var d = prov.Open(Iori.FromFileName(TestLocations.GraphtestDir + "DocumentTest.limo")); thingGraph = d.Data; this.ReportDetail("**** TestDocumentWithTestData"); var factory = new DigidocSampleFactory(); var digidoc = new DigidocSchema(); var graph = new SchemaThingGraph(thingGraph); Limada.Schemata.Schema.IdentityGraph.ForEach(s => graph.Add(s)); var root = DigidocSchema.DocumentsRoot; var path = TestLocations.BlobSource; var document = digidoc.CreateDocument(graph, path); graph.Add(Factory.CreateEdge(root, document, DigidocSchema.Document)); factory.ReadPagesFromDir(graph, document, path); var docs = graph.Edges(root).Where(l => l.Marker == DigidocSchema.Document).Select(l => l.Leaf); foreach (var doc in docs) { var title = graph.ThingToDisplay(doc); this.ReportDetail(title.ToString()); var pages = graph.Edges(doc).Where(l => l.Marker == DigidocSchema.DocumentPage).Select(l => l.Leaf); foreach (var page in pages) { var number = graph.ThingToDisplay(page); Assert.IsNotNull(number); this.ReportDetail(number.ToString()); } } prov.Flush(d); }
public virtual void TestDocumentWithPages() { this.ReportDetail("**** TestDocumentWithPages"); var factory = new DigidocSampleFactory(); var graph = new SchemaThingGraph(new ThingGraph()); var root = DigidocSchema.DocumentsRoot; factory.CreateDocuments(graph, root, 1); var docs = graph.Edges(root).Where(l => l.Marker == DigidocSchema.Document).Select(l => l.Leaf); foreach (var doc in docs) { var title = graph.ThingToDisplay(doc); this.ReportDetail(title.ToString()); var pages = graph.Edges(doc).Where(l => l.Marker == DigidocSchema.DocumentPage).Select(l => l.Leaf); foreach (var page in pages) { var number = graph.ThingToDisplay(page); Assert.IsNotNull(number); this.ReportDetail(number.ToString()); } } }