private Guid[] CreateResults(IEmployer employer, int results) { // Create jobs. var jobAdIds = new Guid[results]; for (var index = 0; index < results; ++index) { var jobAd = _jobAdsCommand.PostTestJobAd(employer); jobAdIds[index] = jobAd.Id; } return(jobAdIds); }
private void TestSalary(IEmployer employer, Salary salary, Salary expectedSalary) { var jobAd = PostJobAd(employer, j => { j.Description.Salary = salary; }); Get(GetJobUrl(jobAd.Id)); if (expectedSalary != null && !expectedSalary.IsEmpty && !expectedSalary.IsZero) { Assert.AreEqual(GetDisplayText(expectedSalary) + " p.a.", GetSalary()); } else { Assert.AreEqual("Not specified", GetSalary()); } }
protected override IEmployer[] CreateOtherEmployers(IEmployer employer, bool canContact) { // Others in the same organisation can contact. return(canContact ? new IEmployer[] { _employersCommand.CreateTestEmployer(2, employer.Organisation), } : new IEmployer[] { _employersCommand.CreateTestEmployer(1, _organisationsCommand.CreateTestOrganisation(0)), }); }
int IJobAdApplicantsQuery.GetApplicantCount(IEmployer employer, ApplicantList applicantList) { // Check access. if (!CanAccessList(employer, applicantList)) { return(0); } // Only count entries which are not in a blockList. var entries = _contenderListsQuery.GetEntries <ApplicantListEntry>(applicantList.Id, null); if (entries.Count == 0) { return(0); } // Update the entries. var blockedCandidateIds = _blockListsQuery.GetPermanentlyBlockedCandidateIds(employer); if (!blockedCandidateIds.IsNullOrEmpty()) { // Remove any blocked candidates before counting. entries = (from e in entries where !blockedCandidateIds.Contains(e.ApplicantId) select e).ToList(); } // Get all members. var members = _membersQuery.GetMembers(from e in entries select e.ApplicantId).ToDictionary(m => m.Id, m => m); // Need to get counts for all member-generated applications where the member is enabled // plus all employer-generated applications (i.e. manually added) where the member is enabled AND activated return((from s in new[] { ApplicantStatus.New, ApplicantStatus.Rejected, ApplicantStatus.Shortlisted } select new { Status = s, Count = (from e in entries where e.ApplicantStatus == s && members.ContainsKey(e.ApplicantId) let m = members[e.ApplicantId] where m.IsEnabled && (m.IsActivated || e.ApplicantStatus != ApplicantStatus.NotSubmitted) select e).Count() }).Sum(s => s.Count)); }
private Member CreateMember(IEmployer employer, int index, bool inFolder, bool isFlagged, bool hasNotes, bool hasBeenViewed, bool canContact) { var member = _memberAccountsCommand.CreateTestMember(index); _candidatesCommand.AddTestResume(member); // In folder. if (inFolder) { var folder = _candidateFoldersQuery.GetShortlistCandidateFolder(employer); _candidateListsCommand.AddCandidateToFolder(employer, folder, member.Id); } // Is flagged. if (isFlagged) { var flagList = _candidateFlagListsQuery.GetCandidateFlagList(employer); _candidateListsCommand.AddCandidateToFlagList(employer, flagList, member.Id); } // Has notes. if (hasNotes) { var note = new CandidateNote { CandidateId = member.Id, Text = "A note" }; _candidateNotesCommand.CreatePrivateCandidateNote(employer, note); } // Has been viewed. if (hasBeenViewed) { _employerMemberViewsCommand.ViewMember(employer, member); } // Has been contacted. if (canContact) { _employerMemberViewsCommand.AccessMember(employer, _employerMemberViewsQuery.GetProfessionalView(employer, member), MemberAccessReason.PhoneNumberViewed); } _updateMemberSearchCommand.AddMember(member.Id); return(member); }
protected static void AssertBlockList(IEmployer employer, CandidateBlockList expectedBlockList, CandidateBlockList blockList) { Assert.AreNotEqual(Guid.Empty, blockList.Id); Assert.AreNotEqual(DateTime.MinValue, blockList.CreatedTime); if (!((expectedBlockList.BlockListType == BlockListType.Permanent || expectedBlockList.BlockListType == BlockListType.Temporary) && expectedBlockList.Id == Guid.Empty)) { Assert.AreEqual(expectedBlockList.Id, blockList.Id); } Assert.AreEqual(expectedBlockList.Name, blockList.Name); Assert.AreEqual(expectedBlockList.BlockListType, blockList.BlockListType); Assert.IsNull(blockList.Name); Assert.AreEqual(employer.Id, blockList.RecruiterId); Assert.AreEqual(expectedBlockList.RecruiterId, blockList.RecruiterId); }
protected static void AssertFlagList(IEmployer employer, CandidateFlagList expectedFlagList, CandidateFlagList flagList) { Assert.AreNotEqual(Guid.Empty, flagList.Id); Assert.AreNotEqual(DateTime.MinValue, flagList.CreatedTime); if (expectedFlagList.Id != Guid.Empty) { Assert.AreEqual(expectedFlagList.Id, flagList.Id); } Assert.AreEqual(expectedFlagList.Name, flagList.Name); Assert.IsNull(flagList.Name); Assert.AreEqual(employer.Id, flagList.RecruiterId); Assert.AreEqual(expectedFlagList.RecruiterId, flagList.RecruiterId); }
private ICollection <Guid> Filter(IEmployer employer, MemberSearchQuery query, IEnumerable <Guid> allMemberIds) { var includeMemberIds = _memberActivityFiltersQuery.GetIncludeMemberIds(employer, query); var memberIds = includeMemberIds != null ? allMemberIds.Intersect(includeMemberIds) : allMemberIds; var excludeMemberIds = _memberActivityFiltersQuery.GetExcludeMemberIds(employer, query); memberIds = excludeMemberIds != null ? memberIds.Except(excludeMemberIds) : memberIds; return(memberIds.ToArray()); }
protected static void AssertFolder(IEmployer employer, string name, bool isShared, CandidateFolder folder) { Assert.AreEqual(name, folder.Name); Assert.AreEqual(false, folder.IsDeleted); if (isShared) { Assert.AreEqual(true, folder.FolderType == FolderType.Shared); } else { Assert.AreEqual(true, folder.FolderType == FolderType.Private || folder.FolderType == FolderType.Shortlist || folder.FolderType == FolderType.Mobile); } Assert.AreEqual(isShared ? employer.Organisation.Id : (Guid?)null, folder.OrganisationId); Assert.AreEqual(employer.Id, folder.RecruiterId); }
MemberSearchExecution IExecuteMemberSearchCommand.SearchManaged(IEmployer employer, Guid jobAdId, ApplicantStatus status, MemberSearchSortCriteria sortCriteria, Range range) { var criteria = new MemberSearchCriteria { SortCriteria = sortCriteria ?? new MemberSearchSortCriteria { SortOrder = ManagedCandidatesDefaultSortOrder }, HasResume = null, IsActivated = null, IsContactable = null, CandidateStatusFlags = CandidateStatusFlags.All, }; return(Search(employer, criteria, range, (s, e, o, q) => s.SearchManaged(e, o, jobAdId, status, q))); }
private JobAdEntry Post(IEmployer employer) { // Apply for the job. LogIn(employer); Get(_newJobAdUrl); CreateJobAd(employer.EmailAddress.Address); _previewButton.Click(); _publishButton.Click(); var jobAd = _jobAdsQuery.GetJobAds <JobAdEntry>(_jobAdsQuery.GetJobAdIds(employer.Id, JobAdStatus.Open))[0]; LogOut(); return(jobAd); }
protected void AssertNotes(IEmployer employer, Guid candidateId, params CandidateNote[] expectedNotes) { var notes = _candidateNotesQuery.GetNotes(employer, candidateId); Assert.AreEqual(expectedNotes.Length, notes.Count); for (var index = 0; index < expectedNotes.Length; ++index) { var expectedNote = expectedNotes[index]; var note = (from n in notes where n.Text == expectedNote.Text select n).Single(); Assert.IsNotNull(note); Assert.AreEqual(expectedNotes[index].IsShared, note.IsShared); Assert.AreEqual(expectedNotes[index].OrganisationId, note.IsShared ? employer.Organisation.Id : (Guid?)null); Assert.AreEqual(expectedNotes[index].RecruiterId, employer.Id); } }
private JobAd CreateJobAd(IEmployer employer, bool hasLogo, bool hasLogoFeature) { var jobAd = _jobAdsCommand.PostTestJobAd(employer); if (hasLogo) { var fileReference = _filesCommand.CreateTestPhoto(0, FileType.CompanyLogo); jobAd.LogoId = fileReference.Id; } jobAd.Features = hasLogoFeature ? JobAdFeatures.Logo : JobAdFeatures.None; _jobAdsCommand.UpdateJobAd(jobAd); return jobAd; }
protected override IEmployer[] CreateOtherEmployers(IEmployer employer, bool canAccess) { // Others in the same organisation hierarchy can access. return(canAccess ? new IEmployer[] { _employersCommand.CreateTestEmployer(2, employer.Organisation), _employersCommand.CreateTestEmployer(3, _parentOrganisation), } : new IEmployer[] { _employersCommand.CreateTestEmployer(1, _organisationsCommand.CreateTestOrganisation(0)), }); }
private void AssertContents(Stream stream, IEmployer employer, Member member) { string contents; using (var reader = new StreamReader(stream)) { contents = reader.ReadToEnd(); } // Check got resume file. var resumeFile = GetResumeFile(employer, member); Assert.AreEqual(resumeFile.Contents, contents); }
protected void AssertView(IEmployer employer, Member member, CanContactStatus canContact, bool phoneVisible, ProfessionalContactDegree contactDegree) { if (employer == null) { canContact = CanContactStatus.YesIfHadCredit; contactDegree = ProfessionalContactDegree.NotContacted; } var canContactByPhone = phoneVisible ? canContact : CanContactStatus.No; Assert.AreEqual(canContact, _employerMemberViewsQuery.CanContact(employer, member)); var view = _employerMemberViewsQuery.GetProfessionalView(employer, member.Id); Assert.AreEqual(canContact, view.CanContact()); Assert.AreEqual(canContactByPhone, view.CanContactByPhone()); Assert.AreEqual(contactDegree, view.EffectiveContactDegree); Assert.AreEqual(canContact, _employerMemberViewsQuery.GetProfessionalView(employer, member.Id).CanContact()); Assert.AreEqual(canContact, _employerMemberViewsQuery.GetProfessionalView(employer, member).CanContact()); Assert.AreEqual(canContact, _employerMemberViewsQuery.GetProfessionalViews(employer, new[] { member.Id })[member.Id].CanContact()); Assert.AreEqual(canContact, _employerMemberViewsQuery.GetEmployerMemberView(employer, member.Id).CanContact()); Assert.AreEqual(canContact, _employerMemberViewsQuery.GetEmployerMemberViews(employer, new[] { member.Id })[member.Id].CanContact()); Assert.AreEqual(contactDegree, _employerMemberViewsQuery.GetProfessionalView(employer, member.Id).EffectiveContactDegree); Assert.AreEqual(contactDegree, _employerMemberViewsQuery.GetProfessionalView(employer, member).EffectiveContactDegree); Assert.AreEqual(contactDegree, _employerMemberViewsQuery.GetProfessionalViews(employer, new[] { member.Id })[member.Id].EffectiveContactDegree); view = _employerMemberViewsQuery.GetProfessionalView(employer, member); Assert.AreEqual(canContact, view.CanContact()); Assert.AreEqual(canContactByPhone, view.CanContactByPhone()); Assert.AreEqual(contactDegree, view.EffectiveContactDegree); view = _employerMemberViewsQuery.GetProfessionalViews(employer, new[] { member.Id })[member.Id]; Assert.AreEqual(canContact, view.CanContact()); Assert.AreEqual(canContactByPhone, view.CanContactByPhone()); Assert.AreEqual(contactDegree, view.EffectiveContactDegree); view = _employerMemberViewsQuery.GetEmployerMemberView(employer, member.Id); Assert.AreEqual(canContact, view.CanContact()); Assert.AreEqual(canContactByPhone, view.CanContactByPhone()); Assert.AreEqual(contactDegree, view.EffectiveContactDegree); view = _employerMemberViewsQuery.GetEmployerMemberViews(employer, new[] { member.Id })[member.Id]; Assert.AreEqual(canContact, view.CanContact()); Assert.AreEqual(canContactByPhone, view.CanContactByPhone()); Assert.AreEqual(contactDegree, view.EffectiveContactDegree); }
private bool CanSelectCommunity(IEmployer employer) { var communityId = ActivityContext.Community.Id; if (communityId == null) { return(true); } var community = _communitiesQuery.GetCommunity(communityId.Value); if (community == null) { return(true); } // If the community does not have any members then can. if (!community.HasMembers) { return(true); } // If the community explicitly allows full search then can. if (community.OrganisationsCanSearchAllMembers) { return(true); } // An anonymous employer cannot. if (employer == null) { return(false); } // An employer with no affiliation to any community can. if (employer.Organisation.AffiliateId == null) { return(true); } // An employer with an affiliation to this community cannot. return(false); }
private IList <MemberAccess> AccessMembers(ChannelApp app, IEmployer employer, ProfessionalViews views, MemberAccessReason reason) { switch (views.Count()) { case 0: return(new List <MemberAccess>()); case 1: return(new List <MemberAccess> { AccessMember(app, employer, views.First(), reason) }); default: return(AccessBulkMembers(app, employer, views, reason)); } }
private void CheckCanAccessMembers(IEmployer employer, ProfessionalViews views, MemberAccessReason reason) { switch (views.Count()) { case 0: break; case 1: CheckCanAccessMember(employer, views.First(), reason); break; default: CheckCanAccessBulkMembers(employer, views, reason); break; } }
private CandidateNote CreateNote(int index, IEmployer noteCreator, Guid memberId, bool isShared) { var note = new CandidateNote { CandidateId = memberId, Text = string.Format(TextFormat, index) }; if (isShared) { _candidateNotesCommand.CreateSharedNote(noteCreator, note); } else { _candidateNotesCommand.CreatePrivateNote(noteCreator, note); } return(note); }
private BrowseListModel Browse(IEmployer employer, MemberSearchCriteria criteria, CandidatesPresentationModel presentation) { var canSearchByName = CanSearchByName(employer); var canSelectCommunity = CanSelectCommunity(employer); var browseList = GetSearchList( Search <BrowseListModel>(employer, PrepareCriteriaForSearch(criteria, canSelectCommunity), presentation), canSearchByName, canSelectCommunity, null); // Save the basis for the search. EmployerContext.CurrentCandidates = new BrowseCandidatesNavigation((IUrlNamedLocation)browseList.Criteria.Location.NamedLocation, browseList.Criteria.Salary, browseList.Presentation); return(browseList); }
private ProfessionalContactDegree GetEffectiveContactDegree(IEmployer employer, IRegisteredUser member, Allocation contactCreditsAllocation, bool hasBeenAccessed) { if (employer == null) { return(ProfessionalContactDegree.NotContacted); } // Determine whether the contact degree of the contact. var organisationalCreditHierarchy = GetOrganisationHierarchyPath(employer); var contactDegree = _contendersQuery.GetContactDegree(organisationalCreditHierarchy, member.Id); // If they are paid or an applicant then return that. return(GetEffectiveContactDegree(employer, member, contactDegree, contactCreditsAllocation, hasBeenAccessed)); }
private Allocation GetContactCreditsAllocation(IEmployer employer) { // Anonymous employer means no contact credits expired in the past. if (employer == null) { return new Allocation { RemainingQuantity = 0, ExpiryDate = DateTime.MinValue } } ; // Check the employer's and their organisation's active allocations. return(_employerCreditsQuery.GetEffectiveActiveAllocation <ContactCredit>(employer)); }
private void SetView(IEmployer employer, Guid memberId, EmployerMemberView view) { var candidate = _candidatesQuery.GetCandidate(memberId); var resume = candidate.ResumeId == null ? null : _resumesQuery.GetResume(candidate.ResumeId.Value); view.Set( candidate, resume, HasViewedMember(employer, memberId), _candidateFlagListsQuery.IsFlagged(employer, memberId), _candidateFoldersQuery.IsInMobileFolder(employer, memberId), _candidateFoldersQuery.GetFolderCount(employer, memberId), _candidateNotesQuery.GetNoteCount(employer, memberId)); }
protected static void AssertBlockLists(IEmployer employer, IList<CandidateBlockList> blockLists) { // Should always have a flagged and shortlist blockList. Assert.AreEqual(2, blockLists.Count); // Look for the temporary blockList. var flaggedBlockList = new CandidateBlockList { RecruiterId = employer.Id, BlockListType = BlockListType.Temporary }; AssertBlockList(employer, flaggedBlockList, (from f in blockLists where f.BlockListType == BlockListType.Temporary select f).Single()); // Look for the shortlist blockList. var shortlistBlockList = new CandidateBlockList { RecruiterId = employer.Id, BlockListType = BlockListType.Permanent }; AssertBlockList(employer, shortlistBlockList, (from f in blockLists where f.BlockListType == BlockListType.Permanent select f).Single()); }
protected void AssertActiveAllocations <T>(IEmployer owner, DateTime?expiryDate1, int?initialQuantity1, int?remainingQuantity1, bool deallocated1, int?deallocationQuantity1, Guid?referenceId1, DateTime?expiryDate2, int?initialQuantity2, int?remainingQuantity2, bool deallocated2, int?deallocationQuantity2, Guid?referenceId2) where T : Credit { if (expiryDate1 != null) { expiryDate1 = expiryDate1.Value.Date; } if (expiryDate2 != null) { expiryDate2 = expiryDate2.Value.Date; } // Assumed that expiryDate1 < expiryDate2. var allocations = _allocationsQuery.GetActiveAllocations(owner.Id); Assert.AreEqual(2, allocations.Count); AssertAllocation <T>(expiryDate1, initialQuantity1, remainingQuantity1, deallocated1, referenceId1, allocations[0]); AssertAllocation <T>(expiryDate2, initialQuantity2, remainingQuantity2, deallocated2, referenceId2, allocations[1]); // GetActiveAllocations<T> allocations = _allocationsQuery.GetActiveAllocations <T>(owner.Id); Assert.AreEqual(2, allocations.Count); AssertAllocation <T>(expiryDate1, initialQuantity1, remainingQuantity1, deallocated1, referenceId1, allocations[0]); AssertAllocation <T>(expiryDate2, initialQuantity2, remainingQuantity2, deallocated2, referenceId2, allocations[1]); // GetEffectiveActiveAllocation var allocation = _employerCreditsQuery.GetEffectiveActiveAllocation <T>(owner); Assert.IsNotNull(allocation); Assert.AreEqual(initialQuantity1 == null || initialQuantity2 == null, allocation.InitialQuantity == null); Assert.AreEqual(remainingQuantity1 == null || remainingQuantity2 == null, allocation.RemainingQuantity == null); Assert.IsNull(allocation.DeallocatedTime); var creditId = _creditsQuery.GetCredit <T>().Id; var groupedAllocations = _employerCreditsQuery.GetEffectiveActiveAllocations(owner, new[] { creditId }); Assert.AreEqual(1, groupedAllocations.Count); allocation = groupedAllocations[creditId]; Assert.IsNotNull(allocation); Assert.AreEqual(initialQuantity1 == null || initialQuantity2 == null, allocation.InitialQuantity == null); Assert.AreEqual(remainingQuantity1 == null || remainingQuantity2 == null, allocation.RemainingQuantity == null); Assert.IsNull(allocation.DeallocatedTime); }
protected JsonApplicationResponseModel Apply(IEmployer employer, JobAd jobAd, bool useProfile, string coverLetterText) { Get(GetApplyUrl(jobAd.Id)); var div = Browser.CurrentHtml.DocumentNode.SelectSingleNode("//div[@class='button apply']"); Assert.IsNotNull(div); var response = useProfile ? ApiApplyWithProfile(jobAd.Id, coverLetterText) : ApiApplyWithLastUsedResume(jobAd.Id, coverLetterText); Get(GetAppliedUrl(jobAd.Id)); AssertPageContains("Your application has been submitted"); AssertAppliedContact(jobAd.ContactDetails.FullName + " at " + employer.Organisation.FullName + ", " + jobAd.ContactDetails.PhoneNumber); return(response); }
private static bool CanAccessFlagList(IEmployer employer, ContenderList list, bool allowDeleted) { if (employer == null) { return(false); } if (list == null) { return(false); } if (!allowDeleted && list.IsDeleted) { return(false); } return(true); }
IList <Guid> IMemberActivityFiltersQuery.GetExcludeMemberIds(IEmployer employer, MemberSearchQuery query) { // Exclude filters. var memberIds = GetExcludeMemberIds(employer, query, null); // Exclude all blocked candidates. var candidateIds = _candidateBlockListsQuery.GetBlockedCandidateIds(employer); if (candidateIds.Count > 0) { memberIds = GetExcludeList(memberIds, candidateIds); } return(memberIds == null ? null : memberIds.ToList()); }
private static bool CanAccessFolder(IEmployer employer, ContenderList folder, bool allowDeleted) { if (employer == null) { return(false); } if (folder == null) { return(false); } if (!allowDeleted && folder.IsDeleted) { return(false); } return(true); }