public void Create_ConnectorInCrossLayoutGroup_Works()
        {
            var model = _modelBuilder
                        .AddNodes("parent1", "parent2")
                        .AddChildNodes("parent1", "child1")
                        .AddChildNodes("parent2", "child2")
                        .AddRelationships("child1->child2")
                        .Model;
            var parentNode1  = _modelBuilder.GetNode("parent1");
            var parentNode2  = _modelBuilder.GetNode("parent2");
            var relationship = _modelBuilder.GetRelationship("child1->child2");

            var diagramBuilder = new DiagramBuilder(model).AddAllModelNodes().AddAllModelRelationships();

            var layoutStructure = new DiagramLayoutStructure(diagramBuilder.GetDiagram());

            layoutStructure.RootLayoutGroup.Connectors.Should().BeEmpty();
            layoutStructure.CrossLayoutGroupConnectors.ShouldBeEquivalentById(relationship.Id);
            layoutStructure.TryGetLayoutGroupByNodeId(parentNode1.Id).Value.Connectors.Should().BeEmpty();
            layoutStructure.TryGetLayoutGroupByNodeId(parentNode2.Id).Value.Connectors.Should().BeEmpty();
        }
        public void Create_OnlyNodes_Works()
        {
            var model = _modelBuilder
                        .AddNodes("parent")
                        .AddChildNodes("parent", "child")
                        .Model;
            var parentNode = _modelBuilder.GetNode("parent");
            var childNode  = _modelBuilder.GetNode("child");

            var diagramBuilder = new DiagramBuilder(model).AddAllModelNodes();

            var layoutStructure = new DiagramLayoutStructure(diagramBuilder.GetDiagram());

            layoutStructure.RootLayoutGroup.Nodes.ShouldBeEquivalentById(parentNode.Id);
            layoutStructure.TryGetLayoutGroupByNodeId(parentNode.Id).Value.Nodes.ShouldBeEquivalentById(childNode.Id);
        }
예제 #3
0
        public void Create_OnlyNodes_Works()
        {
            var modelService = CreateModelService();
            var parentNode   = modelService.AddNode("parent");
            var childNode    = modelService.AddNode("child", parentNodeId: parentNode.Id);

            var diagramService = CreateDiagramService(modelService.LatestModel);

            diagramService.AddNode(parentNode.Id);
            diagramService.AddNode(childNode.Id, parentNode.Id);

            var layoutStructure = new DiagramLayoutStructure(diagramService.LatestDiagram);

            layoutStructure.RootLayoutGroup.Nodes.ShouldBeEquivalentById(parentNode.Id);
            layoutStructure.TryGetLayoutGroupByNodeId(parentNode.Id).Value.Nodes.ShouldBeEquivalentById(childNode.Id);
        }
예제 #4
0
        public void Create_ConnectorInCrossLayoutGroup_Works()
        {
            var modelService = CreateModelService();
            var parentNode   = modelService.AddNode("parent");
            var childNode    = modelService.AddNode("child", parentNodeId: parentNode.Id);
            var relationship = modelService.AddRelationship(parentNode.Id, childNode.Id);

            var diagramService = CreateDiagramService(modelService.LatestModel);

            diagramService.AddNode(parentNode.Id);
            diagramService.AddNode(childNode.Id, parentNode.Id);
            diagramService.AddConnector(relationship.Id);

            var layoutStructure = new DiagramLayoutStructure(diagramService.LatestDiagram);

            layoutStructure.RootLayoutGroup.Connectors.Should().BeEmpty();
            layoutStructure.CrossLayoutGroupConnectors.ShouldBeEquivalentById(relationship.Id);
            layoutStructure.TryGetLayoutGroupByNodeId(parentNode.Id).Value.Connectors.Should().BeEmpty();
        }