コード例 #1
0
        public void LeaveListByOrgGroupShouldIncludeChildGroupStaff()
        {
            PersonWithStaff rootStaff = null;

            PersonWithStaff aStaff    = null;
            PersonWithStaff bStaff    = null;
            PersonWithStaff a1Staff   = null;
            var             rootGroup = _sf.InsertOrgGroup(action: rootGroupA =>
            {
                rootStaff = _sf.InsertStaff(rootGroupA.Id);
                _sf.InsertOrgGroup(rootGroupA.Id,
                                   action: aGroupA =>
                {
                    aStaff = _sf.InsertStaff(aGroupA.Id);
                    _sf.InsertOrgGroup(aGroupA.Id,
                                       action: a1GroupA => { a1Staff = _sf.InsertStaff(a1GroupA.Id); });
                });

                _sf.InsertOrgGroup(rootGroupA.Id,
                                   action: bGroup => bStaff = _sf.InsertStaff(bGroup.Id));
            });

            rootStaff.ShouldNotBeNull();
            aStaff.ShouldNotBeNull();
            bStaff.ShouldNotBeNull();
            a1Staff.ShouldNotBeNull();
            aStaff.Staff.OrgGroupId.ShouldNotBeNull();
            var actualStaff =
                _leaveService.PeopleInGroupWithLeave(aStaff.Staff.OrgGroupId.Value, DateTime.Now.SchoolYear());

            actualStaff.Select(details => details.Person.Id).ShouldBe(new[] { aStaff.Id, a1Staff.Id }, true);
            actualStaff.Select(details => details.Person.Id).ShouldNotContain(rootStaff.Id);
            actualStaff.Select(details => details.Person.Id).ShouldNotContain(bStaff.Id);
        }