示例#1
0
        protected override void OnChildrenLoaded()
        {
            base.OnChildrenLoaded();

            // Find the highest entity id
            var existingIDs = from x in DataElement.Descendants()
                              let xid = x.Attribute(XSessionNames.AEntityID)
                                        where xid != null
                                        select(int) xid;

            if (existingIDs.Any())
            {
                RuntimeState.InitializeNextEntityID(existingIDs.Max());
            }

            // Find the highest task id
            if (DescendantRuns().Any())
            {
                RuntimeState.InitializeNextTaskID(DescendantRuns().Max(r => r.TaskID));
            }

            // Initialize the Run objects with the RunEntities
            foreach (var run in DescendantRuns())
            {
                if (run.Task == null)
                {
                    // Re-create the task from the run entity
                    run.AssociateTaskFromRun(run);
                }
            }
        }
 protected override IEnumerable <XElement> DescendantXRuns()
 {
     return(DataElement.Descendants(XSessionNames.MCutTestRun));
 }