Exemplo n.º 1
0
        public void MergeSteps(LinkedList <TestStep> parentSteps)
        {
            foreach (var step in parentSteps)
            {
                switch (step.StepOrder)
                {
                case TestStep.Order.Pre:
                    break;

                case TestStep.Order.Case:

                    var lastPre = Steps.LastOrDefault(cs => cs.StepOrder == TestStep.Order.Pre);
                    if (lastPre != null)
                    {
                        Steps.AddAfter(Steps.Find(lastPre), step);
                    }
                    else
                    {
                        Steps.AddFirst(step);
                    }

                    break;

                case TestStep.Order.CasePost:

                    var firstPost = Steps.LastOrDefault(cs => cs.StepOrder == TestStep.Order.Post);
                    if (firstPost != null)
                    {
                        Steps.AddBefore(Steps.Find(firstPost), step);
                    }
                    else
                    {
                        Steps.AddLast(step);
                    }

                    break;

                case TestStep.Order.Post:
                    break;

                default:
                    throw new TestLibsException($"Unknown TestStepOrder: {step.StepOrder}");
                }
            }
        }