Example #1
0
        /// <summary>
        ///     Translates the current step according to the translation dictionary
        ///     Removes all preconditions, actions and expectations
        /// </summary>
        /// <param name="applyTranslation">Indicates that the translation should be applied. Otherwise, this method only cleans the step.
        /// This is used to handle the fact that a blocking error has been found, and translating the sub sequence should be stopped,
        /// but the next steps should be cleaned</param>
        /// <returns>False if an error has been found while translating this step, or if translations should not be applied</returns>
        public bool Translate(bool applyTranslation)
        {
            bool retVal = applyTranslation;

            Counter counter = new Counter();

            counter.visit(this);
            if (counter.Issues[IssueKind.Blocking] != 0)
            {
                retVal = false;
            }

            if (getTranslationRequired())
            {
                Util.DontNotify(() =>
                {
                    setTranslated(false);
                    SubSteps.Clear();

                    if (retVal)
                    {
                        Translation translation = EFSSystem.FindTranslation(this);
                        if (translation != null)
                        {
                            translation.UpdateStep(this);
                            setTranslated(true);
                        }
                        else
                        {
                            AddWarning("Cannot find translation for this step");
                        }
                    }
                });
            }

            return(retVal);
        }