Exemplo n.º 1
0
        /// <summary>
        /// Updates the step according to this translation
        /// </summary>
        /// <param name="step"></param>
        public void UpdateStep(Step step)
        {
            int subStepCounter = 1;

            foreach (SubStep subStep in SubSteps)
            {
                SubStep newSubStep = (SubStep)Generated.acceptor.getFactory().createSubStep();
                newSubStep.Name = "Sub-step" + subStepCounter;
                step.appendSubSteps(newSubStep);

                foreach (Rules.Action action in subStep.Actions)
                {
                    Rules.Action newAct = (Rules.Action)Generated.acceptor.getFactory().createAction();
                    action.copyTo(newAct);
                    newSubStep.appendActions(newAct);
                    Review(newAct);
                }

                foreach (Expectation expectation in subStep.Expectations)
                {
                    Expectation newExp = (Expectation)Generated.acceptor.getFactory().createExpectation();
                    expectation.copyTo(newExp);
                    newSubStep.appendExpectations(newExp);
                    Review(newExp);
                }

                subStepCounter++;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Updates the step according to this translation
        /// </summary>
        /// <param name="step"></param>
        public void UpdateStep(Step step)
        {
            Step previousStep = step.PreviousStep;

            foreach (ReqRef reqRef in Requirements)
            {
                if (!IsRequirementPresent(step, reqRef))
                {
                    step.appendRequirements((ReqRef)reqRef.Duplicate());
                }
            }

            int subStepCounter = 1;

            foreach (SubStep subStep in SubSteps)
            {
                bool addSubStep = true;

                if (subStep.ReferencesMessages())
                {
                    addSubStep = step.Messages.Count > 0;
                }

                if (addSubStep)
                {
                    SubStep newSubStep = (SubStep)acceptor.getFactory().createSubStep();
                    newSubStep.setSkipEngine(subStep.getSkipEngine());
                    newSubStep.Comment = subStep.Comment;
                    newSubStep.Name    = subStep.Name;
                    step.appendSubSteps(newSubStep);

                    if (previousStep != null && previousStep.Distance != step.Distance && subStepCounter == 1)
                    {
                        Action newAct   = (Action)acceptor.getFactory().createAction();
                        string distance = step.getDistance();
                        if (!distance.Contains("."))
                        {
                            distance = distance + ".0";
                        }
                        newAct.ExpressionText = "OdometryInterface.UpdateDistance ( " + distance + " )";
                        newSubStep.setSkipEngine(false);
                        newSubStep.appendActions(newAct);
                    }

                    foreach (Action action in subStep.Actions)
                    {
                        Action newAct = (Action)action.Duplicate();
                        newSubStep.appendActions(newAct);
                        Review(newAct);
                    }

                    foreach (Expectation expectation in subStep.Expectations)
                    {
                        Expectation newExp = (Expectation)expectation.Duplicate();
                        newSubStep.appendExpectations(newExp);
                        Review(newExp);
                    }
                }
                subStepCounter++;
            }
        }