예제 #1
0
        /// <summary>
        /// Get the BDD methods chain list indicating which method raised the error.
        /// </summary>
        /// <param name="methods">The methods.</param>
        /// <param name="methodDescription">The method description.</param>
        /// <returns>The BDD methods chain list indicating which method raised the error.</returns>
        public virtual string GetbddMethodLocationForSpecificMethod(List <FullMethodDescription> methods, FullMethodDescription methodDescription)
        {
            string result = string.Empty;

            for (int index = 0; index < methods.Count; index++)
            {
                FullMethodDescription method = methods[index];
                string partialString         = string.Empty;
                if (method.Equals(methodDescription))
                {
                    partialString = "\n---------->$ & %%%";
                }
                else
                {
                    partialString = "\n           $ & %%%";
                }

                string indenting    = this.GetIndentingForMethod(method);
                string methodText   = this.GetMethodText(method);
                string stepTypeText = this.GetStepTypeText(method);
                result += partialString.Replace("$", stepTypeText).Replace("&", indenting).Replace("%%%", methodText);
            }

            return(result);
        }
예제 #2
0
        /// <summary>
        /// Gets the scenario text indicating the sentence that raises the error.
        /// </summary>
        /// <param name="methods">The methods.</param>
        /// <param name="methodDescription">The method description.</param>
        /// <returns>The scenario text indicating the sentence that raised the error.</returns>
        public virtual string GetScenarioTextForErrorInSpecificMethod(List <FullMethodDescription> methods, FullMethodDescription methodDescription)
        {
            string result                 = string.Empty;
            Type   previousStepType       = null;
            bool   nextMainMethodHasError = false;

            for (int index = 0; index < methods.Count; index++)
            {
                FullMethodDescription method = methods[index];
                if (method.MainMethod == null)
                {
                    Type   currentStepType = method.StepType;
                    string label           = this.GetLabel(previousStepType, currentStepType);
                    string partialString   = string.Empty;
                    if (method.Equals(methodDescription) || nextMainMethodHasError)
                    {
                        partialString = "\n----------> &&&&& %%%";
                    }
                    else
                    {
                        partialString = "\n            &&&&& %%%";
                    }

                    result                += partialString.Replace("&&&&&", label).Replace("%%%", method.GetDecodifiedText());
                    previousStepType       = method.StepType;
                    nextMainMethodHasError = false;
                }
                else
                {
                    if (method.Equals(methodDescription))
                    {
                        nextMainMethodHasError = true;
                    }
                }
            }

            return(result);
        }