public void AddChildNodesToGroupTest() { Application application = new Application(); try { // Where ever we are creating object for WorkflowController_Accessor, we need to set the ThisAddIn_Accessor.ExcelApplication to // wither null or actual application object. ThisAddIn_Accessor.ExcelApplication = application; Group childGroup = new Group("Earth", GroupType.ReferenceFrame, null); Layer layer = new Layer(); layer.Name = "Layer1"; layer.Group = childGroup; LayerMap_Accessor localLayerMap = new LayerMap_Accessor(layer); localLayerMap.MapType = LayerMapType.Local; GroupChildren groupChild = LayerMapExtensions_Accessor.AddChildNodesToGroup(localLayerMap); Assert.AreEqual("Earth", groupChild.Name); Assert.AreEqual(1, groupChild.AllChildren.Count); Assert.AreEqual(1, groupChild.Layers.Count); foreach (Layer layerVal in groupChild.Layers) { Assert.AreEqual("Layer1", layerVal.Name); } } finally { application.Close(); } }
public override void Move(Point delta) { base.Move(delta); GroupChildren.ForEach(g => { g.Move(delta); g.UpdatePath(); // TODO: Kludgy workaround for issue #34. if (!canvas.Controller.IsCanvasDragging) { g.Connections.Where(c => c.ToElement.Parent == null).ForEach(c => c.ToElement.MoveElementOrAnchor(c.ToConnectionPoint.Type, delta)); } }); }
public void BuildGroupCollectionTest() { Application application = new Application(); try { Group parentGroup = new Group("Sun", GroupType.ReferenceFrame, null); Group childGroup = new Group("Earth", GroupType.ReferenceFrame, parentGroup); Layer layer = new Layer(); layer.Name = "Layer1"; layer.Group = childGroup; Layer layerMap = new Layer(); layerMap.Name = "Layer2"; layerMap.Group = new Group("Sun", GroupType.ReferenceFrame, null); LayerMap localLayerMap = new LayerMap(layer); localLayerMap.MapType = LayerMapType.Local; LayerMap wwtLayerMap = new LayerMap(layerMap); wwtLayerMap.MapType = LayerMapType.WWT; List <GroupChildren> wwtGroups = new List <GroupChildren>(); List <GroupChildren> localGroups = new List <GroupChildren>(); List <GroupChildren> existingGroups = new List <GroupChildren>(); List <GroupChildren> groupwithChildren = new List <GroupChildren>(); GroupChildren children = new GroupChildren(); children.Group = parentGroup; GroupChildren children1 = new GroupChildren(); children1.Group = childGroup; GroupChildren childNode = new GroupChildren(); childNode.Group = parentGroup; childNode.Children.Add(children1); existingGroups.Add(children); groupwithChildren.Add(childNode); LayerMapExtensions.BuildGroupCollection(wwtLayerMap, wwtGroups); LayerMapExtensions.BuildGroupCollection(localLayerMap, localGroups); LayerMapExtensions.BuildGroupCollection(localLayerMap, existingGroups); LayerMapExtensions.BuildGroupCollection(localLayerMap, groupwithChildren); Assert.AreEqual(1, wwtGroups.Count); foreach (GroupChildren child in wwtGroups) { Assert.AreEqual(1, child.AllChildren.Count); Assert.AreEqual("Sun", child.Name); } Assert.AreEqual(1, localGroups.Count); foreach (GroupChildren child in localGroups) { Assert.AreEqual(1, child.Children.Count); Assert.AreEqual("Sun", child.Name); } Assert.AreEqual(1, existingGroups.Count); foreach (GroupChildren child in existingGroups) { Assert.AreEqual(1, child.Children.Count); foreach (GroupChildren childrenVal in child.Children) { Assert.AreEqual("Earth", childrenVal.Name); } } Assert.AreEqual(1, groupwithChildren.Count); foreach (GroupChildren child in groupwithChildren) { Assert.AreEqual(1, child.Children.Count); foreach (GroupChildren childrenVal in child.Children) { Assert.AreEqual(1, childrenVal.AllChildren.Count); } } } finally { application.Close(); } }