Ejemplo n.º 1
0
        private IList <Guid> GetIncludeMemberIds(IEmployer employer, MemberSearchQuery query, IEnumerable <Guid> memberIds)
        {
            // Include filters.

            if (query.InFolder != null && query.InFolder.Value)
            {
                memberIds = GetIncludeList(memberIds, _candidateFoldersQuery.GetInFolderCandidateIds(employer));
            }

            if (query.IsFlagged != null && query.IsFlagged.Value)
            {
                memberIds = GetIncludeList(memberIds, _candidateFlagListsQuery.GetFlaggedCandidateIds(employer));
            }

            if (query.HasNotes != null && query.HasNotes.Value)
            {
                memberIds = GetIncludeList(memberIds, _candidateNotesQuery.GetHasNotesCandidateIds(employer));
            }

            if (query.HasViewed != null && query.HasViewed.Value)
            {
                memberIds = GetIncludeList(memberIds, _employerMemberViewsQuery.GetViewedMemberIds(employer));
            }

            if (query.IsUnlocked != null && query.IsUnlocked.Value)
            {
                // Must have active allocations or else no-one is unlocked.

                var allocation = GetContactCreditsAllocation(employer);
                memberIds = allocation.HasExpired
                    ? GetIncludeList(memberIds, new Guid[0])
                    : GetIncludeList(memberIds, _employerMemberViewsQuery.GetAccessedMemberIds(employer));
            }

            return(memberIds == null ? null : memberIds.ToList());
        }
Ejemplo n.º 2
0
        private void AssertViewings(IEmployer employer, ICollection <IMember> expectedViewedMembers, IEnumerable <IMember> expectedNotViewedMembers)
        {
            foreach (var viewedMember in expectedViewedMembers)
            {
                Assert.IsTrue(_employerMemberViewsQuery.HasViewedMember(employer, viewedMember.Id));
            }
            foreach (var notViewedMember in expectedNotViewedMembers)
            {
                Assert.IsFalse(_employerMemberViewsQuery.HasViewedMember(employer, notViewedMember.Id));
            }

            var viewedMembers = _employerMemberViewsQuery.GetViewedMemberIds(employer);

            Assert.AreEqual(expectedViewedMembers.Count, viewedMembers.Count);
            foreach (var expectedViewedMember in expectedViewedMembers)
            {
                Assert.IsTrue(viewedMembers.Contains(expectedViewedMember.Id));
            }
            foreach (var expectedNotViewedMember in expectedNotViewedMembers)
            {
                Assert.IsFalse(viewedMembers.Contains(expectedNotViewedMember.Id));
            }
        }