Beispiel #1
0
        public void AddTestG1()
        {
            _manager.RegisterInitialActions(_actions);

            //Arbre initial :
            //  G1 1
            //      T1 1.1
            //      T2 1.2
            //          T21 1.2.1
            //          T22 1.2.2
            //      T3 1.3
            //          T31 1.3.1
            //      T4 1.4

            var newAction = new KAction()
            {
                Label = "New"
            };
            var newItem = _manager.AddAction(newAction, ((ActionGridItem)_collection[0]));

            //Arbre attendu :
            //  G1 1
            //      T1 1.1
            //      T2 1.2
            //          T21 1.2.1
            //          T22 1.2.2
            //      T3 1.3
            //          T31 1.3.1
            //      T4 1.4
            //      New 1.5

            _actions = _manager.GetActionsSortedByWBS();

            InitItemsCollectionAssertions();
            AssertAction(_g1, 0, "1");
            AssertAction(_t1, 1, "1.1");
            AssertAction(_t2, 1, "1.2");
            AssertAction(_t21, 2, "1.2.1");
            AssertAction(_t22, 2, "1.2.2");
            AssertAction(_t3, 1, "1.3");
            AssertAction(_t31, 2, "1.3.1");
            AssertAction(_t4, 1, "1.4");
            AssertAction(newAction, 0, "2");
            EndItemsCollectionAssertions();
        }
Beispiel #2
0
        public void TestCanAddPredecessor()
        {
            var t1 = new KAction()
            {
                Label = "T1", WBS = "1"
            };
            var g1 = new KAction()
            {
                Label = "G1", WBS = "2"
            };
            var t2 = new KAction()
            {
                Label = "T2", WBS = "2.1"
            };
            var t3 = new KAction()
            {
                Label = "T3", WBS = "2.2"
            };
            var t4 = new KAction()
            {
                Label = "T4", WBS = "3"
            };
            var t5 = new KAction()
            {
                Label = "T5", WBS = "4"
            };

            var actions = new List <KAction>()
            {
                t1, g1, t2, t3, t4, t5
            };

            t3.Predecessors.Add(t1);
            t3.Predecessors.Add(t2);
            t4.Predecessors.Add(t3);
            t5.Predecessors.Add(t3);

            var collection = new BulkObservableCollection <DataTreeGridItem>();

            var manager = new GridActionsManager(collection, null, null);

            manager.ChangeView(GanttGridView.WBS, null);

            manager.RegisterInitialActions(actions);

            Assert.IsFalse(ActionsTimingsMoveManagement.CheckCanAddPredecessor(manager.GetActionsSortedByWBS(), t1, t1));
            Assert.IsFalse(ActionsTimingsMoveManagement.CheckCanAddPredecessor(manager.GetActionsSortedByWBS(), t1, t3));
            Assert.IsFalse(ActionsTimingsMoveManagement.CheckCanAddPredecessor(manager.GetActionsSortedByWBS(), g1, t3));

            Assert.IsTrue(ActionsTimingsMoveManagement.CheckCanAddPredecessor(manager.GetActionsSortedByWBS(), t4, t1));
            Assert.IsTrue(ActionsTimingsMoveManagement.CheckCanAddPredecessor(manager.GetActionsSortedByWBS(), t5, t1));
            Assert.IsTrue(ActionsTimingsMoveManagement.CheckCanAddPredecessor(manager.GetActionsSortedByWBS(), t2, t1));
        }