public void TestDeleteDigidocPage() { var sources = MeshTests( SceneTestEnvironment <IThing, ILink> .Create <DigidocSampleFactory> (7)); var source = sources.First(); Assert.IsTrue(source.Source.Source.Count > 0); // set a document in one view // add the first page source.Expand(source.Nodes[iDocument], true); source.ProveViewContains(source.Nodes[iDocument]); source.ProveViewNotContains(source.Nodes[iPage1]); source.Expand(source.Nodes[iPage1], false); source.ProveViewContains(source.Nodes[iDocument], source.Nodes[iPage1]); // view the page in another display // delete it // prove if deleted in all displays var pageViewer = sources.Skip(1).First(); pageViewer.Expand(pageViewer.Nodes[iPage1], false); pageViewer.ProveViewNotContains(pageViewer.Nodes[iDocument]); pageViewer.ProveViewContains(pageViewer.Nodes[iPage1]); pageViewer.Scene.Delete(pageViewer.Nodes[iPage1], null); pageViewer.CommandsPerform(); source.ProveViewNotContains(source.Nodes[iPage1]); pageViewer.ProveViewNotContains(pageViewer.Nodes[iPage1]); }
public void TestDeleteDigidocDependencies() { // test deleting of dependencies var sources = MeshTests( SceneTestEnvironment <IThing, ILink> .Create <DigidocSampleFactory> (7)); var source = sources.First(); // set a document in one view // add the first page source.Expand(source.Nodes[iDocument], true); source.ProveViewContains(source.Nodes[iDocument]); source.ProveViewNotContains(source.Nodes[iPage1]); source.Expand(source.Nodes[iPage1], false); source.ProveViewContains(source.Nodes[iDocument], source.Nodes[iPage1]); // view page1 and 2 in other displays // hide page 1 foreach (var pageViewer in sources.Skip(1)) { pageViewer.Expand(pageViewer.Nodes[iPage1], false); pageViewer.Expand(pageViewer.Nodes[iPage2], false); pageViewer.ProveViewNotContains(pageViewer.Nodes[iDocument]); pageViewer.ProveViewContains(pageViewer.Nodes[iPage1], pageViewer.Nodes[iPage2]); pageViewer.SetFocused(pageViewer.Nodes[iPage1]); pageViewer.SceneFacade.Hide(); pageViewer.CommandsPerform(); pageViewer.ProveViewNotContains(pageViewer.Nodes[iPage1]); pageViewer.ProveContains(pageViewer.Source, pageViewer.Nodes[iPage1]); } // delete the document in first view source.Scene.Delete(source.Nodes[iDocument], null); source.CommandsPerform(); // prove if deleted in all displays foreach (var pageViewer in sources) { pageViewer.ProveViewNotContains(pageViewer.Nodes.Where(n => n != null).ToArray()); pageViewer.ProveNotContains(pageViewer.Source, pageViewer.Nodes.Where(n => n != null).ToArray()); var inner = Innerfactory(pageViewer.SampleFactory); var thingGraph = pageViewer.Source.Source.Unwrap(); pageViewer.ProveNotContains(thingGraph, inner.Nodes.Where(n => n != null).ToArray()); } }
public static VisualThingGraph GetSourceGraph <TFactory> (int count) where TFactory : ISampleGraphFactory <IGraphEntity, IGraphEdge>, new () { var mock = new SceneTestEnvironment <IGraphEntity, IGraphEdge, ProgrammingLanguageFactory <IGraphEntity, IGraphEdge> > (); mock.SampleFactory.Count = count; mock.Display.Reset(); mock.SceneFacade.ShowAllData(); mock.Display.Perform(); var visualGraph = (mock.Scene.Graph as SubGraph <IVisual, IVisualEdge>).Sink; visualGraph.ChangeData = null; visualGraph.GraphChange = null; var sourceGraph = new VisualThingGraph(visualGraph, new ThingGraph()); sourceGraph.Mapper.ConvertSinkSource(); return(sourceGraph); }