示例#1
0
        /// <summary>
        /// Computes the bread crumb of a <see cref="Requirement"/>
        /// </summary>
        /// <param name="requirement">
        /// The <see cref="Requirement"/> of which the bread crumb is to be computed
        /// </param>
        /// <returns>
        /// Requirement: R:ShortName
        /// </returns>
        public static string BreadCrumb(this Requirement requirement)
        {
            if (requirement.Container == null)
            {
                throw new ContainmentException("The BreadCrumb can only be computed when the container property is not null");
            }

            if (requirement.Group == null)
            {
                var requirementsSpecification = (RequirementsSpecification)requirement.Container;

                return(string.Format("{0}.{1}", requirementsSpecification.BreadCrumbPart(), requirement.BreadCrumbPart()));
            }

            var groupBreadCrumb = requirement.Group.BreadCrumb();

            return(string.Format("{0}.{1}", groupBreadCrumb, requirement.BreadCrumbPart()));
        }