示例#1
0
        /// <summary>
        /// Crée l'ActionManager.
        /// </summary>
        private void CreateManager()
        {
            _collection = new BulkObservableCollection <DataTreeGridItem>();

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

            manager.ChangeView(GanttGridView.WBS, null);

            manager.RegisterInitialActions(_actions);
            manager.FixPredecessorsSuccessorsTimings();
        }
示例#2
0
        public void TestGetCriticalPath3()
        {
            // Prédecesseurs multiples
            var t1 = new KAction()
            {
                Label = "T1", WBS = "1", BuildStart = 0, BuildDuration = 2
            };
            var t2 = new KAction()
            {
                Label = "T2", WBS = "2", BuildStart = 0, BuildDuration = 3
            };
            var t3 = new KAction()
            {
                Label = "T3", WBS = "3", BuildStart = 0, BuildDuration = 4
            };
            var t4 = new KAction()
            {
                Label = "T4", WBS = "4", BuildStart = 0, BuildDuration = 2
            };
            var t5 = new KAction()
            {
                Label = "T5", WBS = "5", BuildStart = 0, BuildDuration = 2
            };

            var actions = new List <KAction>()
            {
                t1, 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);
            manager.FixPredecessorsSuccessorsTimings();

            var actual   = manager.UpdateCriticalPath().ToList();
            var expected = new List <ActionPath>()
            {
                actual.First(c => c.Action == t2),
                actual.First(c => c.Action == t3),
                actual.First(c => c.Action == t4)
            };

            CollectionAssert.AreEqual(expected, actual);
        }
示例#3
0
        public void TestGetCriticalPath1()
        {
            var g1 = new KAction()
            {
                Label = "G1", WBS = "1"
            };
            var t1 = new KAction()
            {
                Label = "T1", WBS = "1.1", BuildStart = 0, BuildDuration = 2
            };
            var t2 = new KAction()
            {
                Label = "T2", WBS = "1.2"
            };
            var t21 = new KAction()
            {
                Label = "T21", WBS = "1.2.1", BuildStart = 0, BuildDuration = 2
            };
            var t22 = new KAction()
            {
                Label = "T22", WBS = "1.2.2", BuildStart = 0, BuildDuration = 2
            };

            var actions = new List <KAction>()
            {
                g1, t1, t2, t21, t22
            };

            t22.Predecessors.Add(t1);
            t21.Predecessors.Add(t22);

            var collection = new BulkObservableCollection <DataTreeGridItem>();

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

            manager.ChangeView(GanttGridView.WBS, null);

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

            var actual = manager.UpdateCriticalPath().ToList();
            //var actual = manager.GetCriticalPathv2().ToList();
            var expected = new List <ActionPath>()
            {
                actual.First(c => c.Action == t1),
                actual.First(c => c.Action == t22),
                actual.First(c => c.Action == t21)
            };

            CollectionAssert.AreEqual(expected, actual);
        }
示例#4
0
        public void TestGetCriticalPath_Bug1545_Equivalent()
        {
            var t1 = new KAction()
            {
                Label = "T1", WBS = "1", BuildStart = 0, BuildDuration = 1
            };
            var t2 = new KAction()
            {
                Label = "T2", WBS = "2", BuildStart = 0, BuildDuration = 0
            };
            var t3 = new KAction()
            {
                Label = "T3", WBS = "3", BuildStart = 2, BuildDuration = 1
            };

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

            t2.Predecessors.Add(t1);

            var collection = new BulkObservableCollection <DataTreeGridItem>();

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

            manager.ChangeView(GanttGridView.WBS, null);

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

            var actual   = manager.UpdateCriticalPath().ToList();
            var expected = new List <ActionPath>()
            {
                actual.First(c => c.Action == t1),
                actual.First(c => c.Action == t2),
                actual.First(c => c.Action == t3)
            };

            CollectionAssert.AreEqual(expected, actual);
        }
示例#5
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);
        }