예제 #1
0
        public void DeleteTestT13()
        {
            _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

            _manager.DeleteAction(((ActionGridItem)_collection[5]).Action);

            //Arbre attendu :
            //  G1 1
            //      T1 1.1
            //      T2 1.2
            //          T21 1.2.1
            //          T22 1.2.2
            //          T31 1.2.3
            //      T4 1.3

            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(_t31, 2, "1.3");
            AssertAction(_t4, 1, "1.4");
            EndItemsCollectionAssertions();
        }
예제 #2
0
        public void TestDelete()
        {
            // Voilà une représentation des tâches
            // -- T1
            //   -- T2
            //     -- T3
            //   - T4

            // Et les précédesseurs :
            // T3 -> T2 -> T1,
            // T3 -> T4 -> T1

            // Le test va consister à supprimer T2
            // Quand on le supprime, T3 devrait se décaller de 1 vers la droite que correspondre au précédesseur T4

            var t1 = new KAction
            {
                Label       = "T1",
                WBS         = "1",
                Start       = 0,
                Finish      = 1,
                BuildStart  = 0,
                BuildFinish = 2,
            };

            var t2 = new KAction
            {
                Label        = "T2",
                WBS          = "2",
                Start        = 0,
                Finish       = 1,
                BuildStart   = 0,
                BuildFinish  = 2,
                Predecessors = new TrackableCollection <KAction>()
                {
                    t1
                },
            };

            var t4 = new KAction
            {
                Label        = "T4",
                WBS          = "4",
                Start        = 0,
                Finish       = 1,
                BuildStart   = 0,
                BuildFinish  = 1,
                Predecessors = new TrackableCollection <KAction>()
                {
                    t1
                },
            };

            var t3 = new KAction
            {
                Label        = "T3",
                WBS          = "3",
                Start        = 0,
                Finish       = 1,
                BuildStart   = 0,
                BuildFinish  = 2,
                Predecessors = new TrackableCollection <KAction>()
                {
                    t2, t4
                },
            };


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

            var collection = new BulkObservableCollection <DataTreeGridItem>();

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

            manager.ChangeView(GanttGridView.WBS, null);

            manager.RegisterInitialActions(actions);
            manager.FixPredecessorsSuccessorsTimings();

            Assert.AreEqual(4, t3.BuildStart);
            Assert.AreEqual(6, t3.BuildFinish);

            manager.DeleteAction(t2);

            Assert.AreEqual(3, t3.BuildStart);
            Assert.AreEqual(5, t3.BuildFinish);
        }