Beispiel #1
0
        public void Initialize()
        {
            string importPath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Ressources\Configuration.xlsx");

            ifvm = ToolboxStandardItemsViewModel.Instance;
            glvm = ToolboxGroupsViewModel.Instance;
            WorkspaceViewModel.Instance = null;
            wvm = WorkspaceViewModel.Instance;
            wvm.LoadWorkspace(importPath);
            ifvm.PopulateToolbox();
            glvm.PopulateGTList();
            sfvm = new ToolboxSpecialItemsViewModel();
            gtvm = new GroupTableViewModel();
        }
Beispiel #2
0
        public void DropToolboxStandardItemOnItem()
        {
            ifvm.PopulateToolbox();
            GroupType gt = wvm.PageList[14].GroupTypeOrders[1].Group;

            gtvm.Group = gt;
            List <ToolboxItem> tbiList = ifvm.DesignItemsView.Cast <ToolboxItem>().ToList();
            ToolboxItem        tbi     = tbiList.Find(x => x.ItemType.DesignID.Equals("38")); //ItemType-Name: Temperatur
            int l = 0;

            while (l < gt.ItemOrder.Count)
            {
                GroupType deepCopyGroupType = DeepCopyGroupType(gt);
                ObservableCollection <ItemTypeOrder> modifiedItemTypeOrderList = deepCopyGroupType.ItemOrder;
                gtvm.Group = deepCopyGroupType;
                gtvm.AdjustItemOrder(gtvm.Group);
                ItemTypeOrder        dropTargetItemTypeOrder     = deepCopyGroupType.ItemOrder[l];
                List <ItemTypeOrder> unmodifiedItemTypeOrderList = gt.ItemOrder.ToList();
                int i = deepCopyGroupType.ItemOrder.IndexOf(dropTargetItemTypeOrder);
                gtvm.HandleToolboxItemDrop(deepCopyGroupType, tbi, dropTargetItemTypeOrder);
                int skipped = 0;
                while (i < unmodifiedItemTypeOrderList.Count - skipped)
                {
                    Assert.AreEqual(modifiedItemTypeOrderList[i + 1].ItemOrder,
                                    unmodifiedItemTypeOrderList[i].ItemOrder + 1); //For each itemtype, check if ItemOrder is incremented by 1
                    if (!unmodifiedItemTypeOrderList[i].DesignID.Equals("198"))
                    {
                        Assert.AreEqual(modifiedItemTypeOrderList[i + 1].Item, unmodifiedItemTypeOrderList[i + skipped].Item);
                    }
                    else
                    {
                        skipped++;
                        Assert.AreEqual(modifiedItemTypeOrderList[i + 1].Item, unmodifiedItemTypeOrderList[i + skipped].Item);
                    }
                    i++;
                }
                Assert.AreEqual(modifiedItemTypeOrderList[l].Item.DesignID, tbi.ItemType.DesignID); //Check if dropped ItemType is inserted at the right location
                l++;
            }
        }