Esempio n. 1
0
        public static void ShouldSortGroups(List <OrgGroup> groups,
                                            OrgGroupService.SortedBy sortedBy,
                                            bool expected)
        {
            var sortedGroups = OrgGroupService.SortOrgGroupByHierarchy(groups, sortedBy).ToList();

            OrgGroupService.IsOrgGroupSortedByHierarchy(sortedGroups, sortedBy).ShouldBe(true,
                                                                                         "should have been sorted by " + sortedBy + " but instead was " +
                                                                                         string.Join(", ", sortedGroups.Select(group => group.GroupName)));
        }
Esempio n. 2
0
 public void ShouldFailGracefullyWithLoops()
 {
     var g1Id = Guid.NewGuid();
     var g2Id = Guid.NewGuid();
     var g3Id = Guid.NewGuid();
     var g1   = new OrgGroup {
         Id = g1Id, ParentId = g2Id
     };
     var g2 = new OrgGroup {
         Id = g2Id, ParentId = g3Id
     };
     var g3 = new OrgGroup {
         Id = g3Id, ParentId = g1Id
     };
     var sortedGroups = OrgGroupService
                        .SortOrgGroupByHierarchy(new[] { g1, g2, g3 }, OrgGroupService.SortedBy.ChildFirst).ToList();
 }