コード例 #1
0
        //[TestMethod]
        public void TestTaskGraphAdjustments()
        {
            Activity campaign = null, batch1 = null;

            Activity[] units = new Activity[2];

            Activity[][] opSteps   = new Activity[][] { new Activity[3], new Activity[3] };
            double[][]   durations = new double[][] { new double[] { 30.0, 20.0, 10.0 }, new double[] { 20.0, 30.0, 40.0 } };

            ConstructSchedule(ref campaign, ref batch1, ref units, ref opSteps, durations);

            ITimePeriod tpOp1A = opSteps[0][0].GetTimePeriodAspect(KEY1);
            ITimePeriod tpOp1B = opSteps[0][1].GetTimePeriodAspect(KEY1);
            ITimePeriod tpOp1C = opSteps[0][2].GetTimePeriodAspect(KEY1);

            ITimePeriod tpOp2A = opSteps[1][0].GetTimePeriodAspect(KEY1);
            ITimePeriod tpOp2B = opSteps[1][1].GetTimePeriodAspect(KEY1);
            ITimePeriod tpOp2C = opSteps[1][2].GetTimePeriodAspect(KEY1);

            if (tpOp1B.StartTime < tpOp2B.StartTime)
            {
                tpOp1B.StartTime = tpOp2B.StartTime;
            }
            if (tpOp2B.StartTime < tpOp1B.StartTime)
            {
                tpOp2B.StartTime = tpOp1B.StartTime;
            }

            tpOp1B.AddRelationship(TimePeriod.Relationship.StartsOnStartOf, tpOp2B);
            tpOp2B.AddRelationship(TimePeriod.Relationship.StartsOnStartOf, tpOp1B);

            if (tpOp1C.StartTime < tpOp2C.StartTime)
            {
                tpOp1C.StartTime = tpOp2C.StartTime;
            }
            if (tpOp2C.StartTime < tpOp1C.StartTime)
            {
                tpOp2C.StartTime = tpOp1C.StartTime;
            }

            tpOp1C.AddRelationship(TimePeriod.Relationship.StartsOnStartOf, tpOp2C);
            tpOp2C.AddRelationship(TimePeriod.Relationship.StartsOnStartOf, tpOp1C);


            Dump(campaign);
        }