private void AddBox(IGraphContainer parent)
 {
     Box = new GraphBox();
     Box.SetSize(Width, Height);
     Box.SetPadding(10, 10);
     parent.AddBox(Box);
 }
        private void AddDivider(IGraphContainer parent, IGraphContainer children)
        {
            Divider = new GraphBox {
                SkipCentering = true,
            };

            DividerLeftOffset = children.ChildContainers[0].Width / 2;
            var dividerRightOffset = children.ChildContainers[children.ChildContainers.Count - 1].Width / 2;
            var width = children.Width - DividerLeftOffset - dividerRightOffset;

            Divider.SetSize(width, 1);

            parent.AddBox(Divider);
        }
                public void On_nested_positions_on_added_boxes()
                {
                    var box = new GraphBox();

                    box.SetSize(50, 50);

                    var nestedContainer = new GraphContainerHorizontal();

                    nestedContainer.AddBox(box);

                    _container.SetGlobalPosition(50, 100);
                    _container.AddBox(nestedContainer);

                    Assert.AreEqual(100, box.GlobalPositionY);
                }
        public void Root_should_push_down_the_next_node()
        {
            var tree = new GraphContainerVertical();

            tree.SetGlobalPosition(300, 0);
            var nodeWrapper = new GraphContainerVertical();
            var box         = new GraphBox();

            box.SetSize(50, 50);
            var childrenContainer = new GraphContainerHorizontal();

            var childWrapper = new GraphContainerVertical();
            var childBox     = new GraphBox();

            childBox.SetSize(50, 50);

            nodeWrapper.AddBox(box);
            Assert.AreEqual(50, nodeWrapper.Height);
            Assert.AreEqual(50, nodeWrapper.Width);
            Assert.AreEqual(0, box.GlobalPositionY);

            childWrapper.AddBox(childBox);
            Assert.AreEqual(50, nodeWrapper.Height);
            Assert.AreEqual(50, nodeWrapper.Width);

            childrenContainer.AddBox(childWrapper);
            Assert.AreEqual(50, nodeWrapper.Height);
            Assert.AreEqual(50, nodeWrapper.Width);
            Assert.AreEqual(0, childrenContainer.GlobalPositionY);

            nodeWrapper.AddBox(childrenContainer);
            Assert.AreEqual(100, nodeWrapper.Height);
            Assert.AreEqual(50, nodeWrapper.Width);
            Assert.AreEqual(50, childrenContainer.GlobalPositionY);

            tree.AddBox(nodeWrapper);
            Assert.AreEqual(0, nodeWrapper.LocalPositionY);
            Assert.AreEqual(0, nodeWrapper.GlobalPositionY);
            Assert.AreEqual(50, childrenContainer.GlobalPositionY);
            Assert.AreEqual(0, box.GlobalPositionY);
        }
                public void On_deeply_nested_child_positions_on_added_boxes()
                {
                    var boxA = new GraphBox();

                    boxA.SetSize(50, 50);

                    var boxB = new GraphBox();

                    boxB.SetSize(50, 50);

                    var nestedContainer = new GraphContainerHorizontal();

                    nestedContainer.SetGlobalPosition(100, 50);
                    nestedContainer.AddBox(boxA);
                    nestedContainer.AddBox(boxB);

                    _container.SetGlobalPosition(50, 100);
                    _container.AddBox(nestedContainer);

                    Assert.AreEqual(200, boxB.GlobalPositionX);
                }