Example #1
0
        /// <summary>
        /// Creates a <see cref="List{Thing}"/> that contains <see cref="RequirementsSpecification"/> and its containing
        /// <see cref="RequirementsGroup"/> and <see cref="Requirement"/>
        /// </summary>
        /// <param name="requirementsSpecification"></param>
        /// <returns>
        /// A <see cref="List{Thing}"/> ordered by <see cref="IBreadCrumb"/>
        /// </returns>
        private IEnumerable <Thing> CreateSortedContent(RequirementsSpecification requirementsSpecification)
        {
            var things = new List <Thing>();

            things.Add(requirementsSpecification);
            var allGroups = requirementsSpecification.GetAllContainedGroups();

            things.AddRange(allGroups);
            things.AddRange(requirementsSpecification.Requirement);

            var contentComparer = new RequirementsSpecificationContentComparer();

            things.Sort(contentComparer);

            return(things);
        }
        public void VerifyThatGetAllGroupsWorks()
        {
            var spec   = new RequirementsSpecification();
            var grp1   = new RequirementsGroup();
            var grp11  = new RequirementsGroup();
            var grp111 = new RequirementsGroup();
            var grp12  = new RequirementsGroup();

            var grp2  = new RequirementsGroup();
            var grp21 = new RequirementsGroup();

            var grp3 = new RequirementsGroup();

            spec.Group.Add(grp1);
            spec.Group.Add(grp2);
            spec.Group.Add(grp3);

            grp1.Group.Add(grp11);
            grp1.Group.Add(grp12);

            grp11.Group.Add(grp111);

            grp2.Group.Add(grp21);

            var specAllGroups = spec.GetAllContainedGroups();

            Assert.AreEqual(7, specAllGroups.Count());

            var grp1AllGroup = grp1.GetAllContainedGroups();

            Assert.AreEqual(3, grp1AllGroup.Count());

            var grp2AllGroup = grp2.GetAllContainedGroups();

            Assert.AreEqual(1, grp2AllGroup.Count());
        }