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))); }
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(); }
public OrgGroupTests(ServicesFixture sf) { _sf = sf; _groupService = _sf.Get <OrgGroupService>(); _groupRepository = _sf.Get <OrgGroupRepository>(); _transaction = _sf.DbConnection.BeginTransaction(); var orgRootId = Guid.NewGuid(); org1Super = _sf.InsertPerson(); org1 = _sf.InsertOrgGroup(orgRootId, org1Super.Id, name: "org1", approvesLeave: true); org2Super = _sf.InsertPerson(); org2 = _sf.InsertOrgGroup(orgRootId, org2Super.Id, name: "org2", approvesLeave: true); org2a = _sf.InsertOrgGroup(org2.Id, name: "org2a"); org1aSuper = _sf.InsertPerson(); org1a = _sf.InsertOrgGroup(org1.Id, org1aSuper.Id, name: "org1a"); orgRoot = _sf.InsertOrgGroup(action: group => group.Id = orgRootId, name: "orgRoot"); org2aStaff = _sf.InsertStaff(org2a.Id); org1Staff = _sf.InsertStaff(org1.Id); org1aStaff = _sf.InsertStaff(org1a.Id); }
public OrgGroupController(OrgGroupService orgGroupService) { _orgGroupService = orgGroupService; }
public StaffEditAuthorizationHandler(OrgGroupService orgGroupService) { _orgGroupService = orgGroupService; }
public PersonEditAuthorizationHandlerLazy(OrgGroupService orgGroupService) { _orgGroupService = orgGroupService; }
public static void ShouldValidateOrderOfOrgGroups(List <OrgGroup> groups, OrgGroupService.SortedBy sortedBy, bool expected) { OrgGroupService.IsOrgGroupSortedByHierarchy(groups, sortedBy).ShouldBe(expected); }