コード例 #1
0
        public void CreateDerivatedScenario_Bug1552_Test()
        {
            var scenarioCible1 = new Scenario()
            {
                NatureCode = KnownScenarioNatures.Target,
            };

            var actionEScenario1 = new KAction
            {
                Scenario      = scenarioCible1,
                BuildDuration = 1,
                Reduced       = new KActionReduced()
                {
                    ActionTypeCode = KnownActionCategoryTypes.E,
                    ReductionRatio = .1,
                },
                WBS = "1",
            };

            var newScenario = ScenarioCloneManager.CreateDerivatedScenario(null, scenarioCible1, KnownScenarioNatures.Target, false, 2);

            var actionEScenario2 = newScenario.Actions.First();

            Assert.IsTrue(actionEScenario2.IsReduced);
            Assert.AreEqual(KnownActionCategoryTypes.E, actionEScenario2.Reduced.ActionTypeCode);
        }
コード例 #2
0
        public void CreateDerivatedScenarioTest2()
        {
            var scenarioCible1 = new Scenario()
            {
                NatureCode = KnownScenarioNatures.Initial,
            };

            var cat  = new ActionCategoryProject {
            };
            var catI = new ActionCategoryProject {
                ActionTypeCode = KnownActionCategoryTypes.I
            };
            var catE = new ActionCategoryProject {
                ActionTypeCode = KnownActionCategoryTypes.E
            };
            var catS = new ActionCategoryProject {
                ActionTypeCode = KnownActionCategoryTypes.S
            };

            var a = new KAction {
                Scenario = scenarioCible1, Category = cat, WBS = "1"
            };
            var aI = new KAction {
                Scenario = scenarioCible1, Category = catI, WBS = "2"
            };
            var aE = new KAction {
                Scenario = scenarioCible1, Category = catE, WBS = "3"
            };
            var aS = new KAction {
                Scenario = scenarioCible1, Category = catS, WBS = "4"
            };

            var newScenario = ScenarioCloneManager.CreateDerivatedScenario(null, scenarioCible1, KnownScenarioNatures.Target, false, 2);

            Assert.AreEqual(KnownActionCategoryTypes.I, newScenario.Actions[0].Reduced.ActionTypeCode);
            Assert.AreEqual(KnownActionCategoryTypes.I, newScenario.Actions[1].Reduced.ActionTypeCode);
            Assert.AreEqual(KnownActionCategoryTypes.E, newScenario.Actions[2].Reduced.ActionTypeCode);
            Assert.AreEqual(KnownActionCategoryTypes.S, newScenario.Actions[3].Reduced.ActionTypeCode);
        }
コード例 #3
0
        public void CreateDerivatedScenario_TargetToTarget_Test()
        {
            var scenario = new Scenario
            {
                NatureCode = KnownScenarioNatures.Target,
            };


            var catI = new ActionCategoryStandard {
                ActionTypeCode = KnownActionCategoryTypes.I
            };
            var catE = new ActionCategoryStandard {
                ActionTypeCode = KnownActionCategoryTypes.E
            };
            var catS = new ActionCategoryStandard {
                ActionTypeCode = KnownActionCategoryTypes.S
            };

            var actionIGrandParent = new KAction
            {
                Scenario      = scenario,
                Duration      = 27,
                BuildDuration = 27,
                Reduced       = new KActionReduced
                {
                    ActionTypeCode        = KnownActionCategoryTypes.I,
                    ReductionRatio        = .1,
                    OriginalBuildDuration = 30,
                },
                OriginalActionId = -1, // simule un original en dehors du scénario
                Category         = catE,
                WBS = "1",
            };

            var actionIparentCatI = new KAction
            {
                Scenario      = scenario,
                Duration      = 27,
                BuildDuration = 27,
                Reduced       = new KActionReduced
                {
                    ActionTypeCode        = KnownActionCategoryTypes.I,
                    ReductionRatio        = .1,
                    OriginalBuildDuration = 30,
                },
                Category = catI,
                WBS      = "2",
            };

            var actionIparentCatE = new KAction
            {
                Scenario      = scenario,
                Duration      = 27,
                BuildDuration = 27,
                Reduced       = new KActionReduced
                {
                    ActionTypeCode        = KnownActionCategoryTypes.I,
                    ReductionRatio        = .1,
                    OriginalBuildDuration = 30,
                },
                Category = catE,
                WBS      = "3",
            };

            var actionIparentCatS = new KAction
            {
                Label         = "actionIparentCatS",
                Scenario      = scenario,
                Duration      = 27,
                BuildDuration = 27,
                Reduced       = new KActionReduced
                {
                    ActionTypeCode        = KnownActionCategoryTypes.I,
                    ReductionRatio        = .1,
                    OriginalBuildDuration = 30,
                },
                Category = catS,
                WBS      = "4",
            };

            var actionE = new KAction
            {
                Scenario      = scenario,
                Duration      = 27,
                BuildDuration = 27,
                Reduced       = new KActionReduced
                {
                    ActionTypeCode        = KnownActionCategoryTypes.E,
                    ReductionRatio        = .1,
                    OriginalBuildDuration = 30,
                },
                Category = catI,
                WBS      = "5",
            };

            var actionS = new KAction
            {
                Label         = "actionS",
                Scenario      = scenario,
                Duration      = 0,
                BuildDuration = 0,
                Reduced       = new KActionReduced
                {
                    ActionTypeCode = KnownActionCategoryTypes.S,
                    ReductionRatio = 1,
                },
                WBS = "6",
            };

            var newScenario = ScenarioCloneManager.CreateDerivatedScenario(null, scenario, KnownScenarioNatures.Target, false, 2);

            // Tache I provenant du grand parent, on n'applique pas le prétype mais on applique la réduc
            var cloneIGrandParent = newScenario.Actions[0];

            AssertClonedAction(cloneIGrandParent, 27, true, 0, 27, KnownActionCategoryTypes.I);

            // Tache I provenant du parent, on applique le prétypage et la réduc s'il y en a : prétypage I
            var cloneIparentCatI = newScenario.Actions[1];

            AssertClonedAction(cloneIparentCatI, 27, true, 0, 27, KnownActionCategoryTypes.I);

            // Tache I provenant du parent, on applique le prétypage et la réduc s'il y en a : prétypage E
            var cloneIparentCatE = newScenario.Actions[2];

            AssertClonedAction(cloneIparentCatE, 27, true, 0, 27, KnownActionCategoryTypes.E);

            // Tache I provenant du parent, on applique le prétypage et la réduc s'il y en a : prétypage S => Suppression
            var cloneIparentCatS = newScenario.Actions[0];

            Assert.IsTrue(!newScenario.Actions.Any(a => a.Label == actionIparentCatS.Label));

            // Tâche E, on conserve E et on applique la réduc
            var cloneE = newScenario.Actions[3];

            AssertClonedAction(cloneE, 27, true, 0, 27, KnownActionCategoryTypes.E);

            // Tâche S, on supprime l'action
            var cloneS = newScenario.Actions[0];

            Assert.IsTrue(!newScenario.Actions.Any(a => a.Label == actionS.Label));
        }