Esempio n. 1
0
        internal override IEnumerable <TestActivity> GetChildren()
        {
            List <TestFlowConditional> conditionals = new List <TestFlowConditional>();
            List <TestFlowSwitchBase>  switches     = new List <TestFlowSwitchBase>();
            List <TestActivity>        activities   = new List <TestActivity>();

            TestFlowElement current = _startElement;

            while (current != null)
            {
                if (current is TestFlowConditional && !conditionals.Contains((TestFlowConditional)current))
                {
                    conditionals.Add((TestFlowConditional)current);
                }
                else if (current is TestFlowSwitchBase && !switches.Contains((TestFlowSwitchBase)current))
                {
                    switches.Add((TestFlowSwitchBase)current);
                }
                else if (current is TestFlowStep && ((TestFlowStep)current).ActionActivity != null)
                {
                    activities.Add(((TestFlowStep)current).ActionActivity);
                }
                current = current.GetNextElement();
            }

            ResetConditionalsIterationCounter(conditionals);
            ResetSwitchesIterationCounter(switches);
            return(activities);
        }
Esempio n. 2
0
        private TestFlowStep GetFlowStepContainingActionActivity(TestActivity activity)
        {
            if (_startElement == null || activity == null)
            {
                return(null);
            }

            List <TestFlowConditional> conditionals = new List <TestFlowConditional>();
            List <TestFlowSwitchBase>  switches     = new List <TestFlowSwitchBase>();
            TestFlowElement            current      = _startElement;

            while (current != null)
            {
                if (current is TestFlowConditional && !conditionals.Contains((TestFlowConditional)current))
                {
                    conditionals.Add((TestFlowConditional)current);
                }
                else if (current is TestFlowSwitchBase && !switches.Contains((TestFlowSwitchBase)current))
                {
                    switches.Add((TestFlowSwitchBase)current);
                }
                else if (current is TestFlowStep && ((TestFlowStep)current).ActionActivity.DisplayName == activity.DisplayName)
                {
                    //Need to reset the iteration numbers of
                    //flowconditionals and flowSwitched since they will be increment
                    //on GetNextElement()
                    ResetConditionalsIterationCounter(conditionals);
                    ResetSwitchesIterationCounter(switches);
                    return(current as TestFlowStep);
                }
                current = current.GetNextElement();
            }

            ResetConditionalsIterationCounter(conditionals);
            ResetSwitchesIterationCounter(switches);
            return(null);
        }