Ejemplo n.º 1
0
        public void TestGetJobApplicationResumeFile()
        {
            // Post job ad.

            var jobPoster      = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0));
            var integratorUser = _integrationCommand.CreateTestIntegratorUser();
            var jobAd          = PostJobAd(jobPoster, integratorUser);

            // Apply.

            var applicant     = _memberAccountsCommand.CreateTestMember(0);
            var fileReference = GetResumeFile();
            var resume        = AddResume(applicant.Id, fileReference);

            var application = new InternalApplication {
                PositionId = jobAd.Id, ApplicantId = applicant.Id, ResumeFileId = fileReference.Id
            };

            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);

            // Get the application.

            AssertSuccess(GetJobApplication(integratorUser, application.Id), applicant, resume, fileReference);
        }
Ejemplo n.º 2
0
        public void TestDeleteApplication()
        {
            var employer    = CreateEmployer();
            var applicantId = Guid.NewGuid();

            // Create an application.

            var jobAd1      = _jobAdsCommand.PostTestJobAd(employer);
            var application = new InternalApplication {
                ApplicantId = applicantId
            };

            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd1, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd1, application);

            var jobAd2 = _jobAdsCommand.PostTestJobAd(employer);

            application = new InternalApplication {
                ApplicantId = applicantId
            };
            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd2, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd2, application);

            AssertApplications(employer, applicantId, jobAd1, jobAd2);

            // Delete the first.

            _jobAdApplicationSubmissionsCommand.RevokeApplication(jobAd1, applicantId);
            AssertApplication(employer, applicantId, jobAd2);

            // Delete the second.

            _jobAdApplicationSubmissionsCommand.RevokeApplication(jobAd2, applicantId);
            AssertNoApplication(employer, applicantId, jobAd1, jobAd2);
        }
Ejemplo n.º 3
0
        public void TestUnknownStatus()
        {
            // Post job ad.

            var jobPoster      = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0));
            var integratorUser = _integrationCommand.CreateTestIntegratorUser();
            var jobAd          = PostJobAd(jobPoster, integratorUser);

            // Apply.

            var applicant   = _memberAccountsCommand.CreateTestMember(0);
            var application = new InternalApplication
            {
                PositionId  = jobAd.Id,
                ApplicantId = applicant.Id,
            };

            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
            AssertStatus(application.Id, true, ApplicantStatus.New);

            // Set status.

            AssertErrors(SetJobApplicationsStatus(integratorUser, "Pending", application), 0, 0, "The value of the 'status' attribute, 'Pending', is not a valid application status.");
        }
Ejemplo n.º 4
0
        void ISendApplicationsCommand.SendApplication(InternalApplication application, IEnumerable <ApplicationAnswer> answers)
        {
            var jobAd = _jobAdsQuery.GetJobAd <JobAdEntry>(application.PositionId);

            // Look for a member first.

            var member = _membersQuery.GetMember(application.ApplicantId);

            if (member != null)
            {
                // Send.

                if (application.ResumeFileId != null)
                {
                    SendResumeFile(application, member, jobAd, answers);
                }
                else
                {
                    SendResume(application, member, jobAd, answers);
                }
            }
            else
            {
                var user = _anonymousUsersQuery.GetContact(application.ApplicantId);
                if (user != null && application.ResumeFileId != null)
                {
                    SendResumeFile(application, user, jobAd, answers);
                }
            }
        }
Ejemplo n.º 5
0
        private void TestResults <T>(bool createReport, Func <Guid, IOrganisation> createOrganisation, Action <Administrator, IOrganisation, EmployerReport> test)
            where T : EmployerReport
        {
            var administrator = _administratorAccountsCommand.CreateTestAdministrator(1);
            var organisation  = createOrganisation(administrator.Id);
            var employer      = _employerAccountsCommand.CreateTestEmployer(1, organisation);
            var member        = _memberAccountsCommand.CreateTestMember(1);

            if (typeof(T) == typeof(ResumeSearchActivityReport))
            {
                _employerMemberViewsCommand.ViewMember(_app, employer, member);
            }
            else if (typeof(T) == typeof(JobBoardActivityReport))
            {
                var jobAd = _jobAdsCommand.PostTestJobAd(employer);
                _jobAdViewsCommand.ViewJobAd(Guid.NewGuid(), jobAd.Id);
                var application = new InternalApplication {
                    ApplicantId = Guid.NewGuid()
                };
                _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
                _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
                _jobAdsCommand.CloseJobAd(jobAd);
            }

            var report = _employerReportsCommand.CreateReportTemplate <T>(organisation.Id);

            if (createReport)
            {
                _employerReportsCommand.CreateReport(report);
            }
            test(administrator, organisation, report);
        }
Ejemplo n.º 6
0
        public void TestShortlistApplicant()
        {
            var employer = CreateEmployer();
            var jobAd    = _jobAdsCommand.PostTestJobAd(employer);

            var members = new Member[3];

            for (var index = 0; index < 3; ++index)
            {
                members[index] = _memberAccountsCommand.CreateTestMember(index);
                var application = new InternalApplication {
                    ApplicantId = members[index].Id
                };
                _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
                _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
            }

            LogIn(employer);
            AssertJobAds(jobAd.Id, 0, 3, 0);
            AssertJobAd(jobAd.Id, 0, 3, 0);

            // Shortlist the first applicant.

            Get(GetManageCandidatesUrl(jobAd.Id));
            AssertModel(ShortlistCandidates(jobAd.Id, members[0]), 1, 2, 0);
            AssertJobAds(jobAd.Id, 1, 2, 0);
            AssertJobAd(jobAd.Id, 1, 2, 0);
        }
Ejemplo n.º 7
0
        public void TestGetJobApplications()
        {
            var employer = CreateEmployer(1);
            var jobAd    = _jobAdsCommand.PostTestJobAd(employer);

            var application = new InternalApplication
            {
                PositionId      = jobAd.Id,
                ApplicantId     = Guid.NewGuid(),
                CoverLetterText = "Cover letter"
            };

            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
            application.CreatedTime = DateTime.Now.AddDays(-1);
            _applicationsCommand.UpdateApplication(application);

            application = new InternalApplication
            {
                PositionId      = jobAd.Id,
                ApplicantId     = Guid.NewGuid(),
                CoverLetterText = "Cover letter"
            };
            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
            application.CreatedTime = DateTime.Now.AddDays(-1);
            _applicationsCommand.UpdateApplication(application);

            Assert.AreEqual(2, _jobAdReportsQuery.GetInternalApplications(DayRange.Yesterday));
        }
Ejemplo n.º 8
0
        public void TestSetStatus()
        {
            // Post job ad.

            var jobPoster      = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0));
            var integratorUser = _integrationCommand.CreateTestIntegratorUser();
            var jobAd          = PostJobAd(jobPoster, integratorUser);

            // Apply.

            var applicant   = _memberAccountsCommand.CreateTestMember(0);
            var application = new InternalApplication {
                PositionId = jobAd.Id, ApplicantId = applicant.Id
            };

            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
            AssertStatus(application.Id, true, ApplicantStatus.New);

            // Set status.

            AssertSuccess(SetJobApplicationsStatus(integratorUser, application), 1, 0);
            AssertStatus(application.Id, false, ApplicantStatus.New);

            // Set status again.

            AssertSuccess(SetJobApplicationsStatus(integratorUser, application), 1, 0);
            AssertStatus(application.Id, false, ApplicantStatus.New);
        }
Ejemplo n.º 9
0
 public JobApplicationEmail(ICommunicationUser from, InternalApplication jobApplication, JobAd jobAd, Stream resumeContents, string resumeFileName)
     : base(GetUnregisteredEmployer(jobAd.ContactDetails.EmailAddress), from)
 {
     _jobApplication = jobApplication;
     _jobAd          = jobAd;
     _resumeContents = resumeContents;
     _resumeFileName = resumeFileName;
 }
Ejemplo n.º 10
0
        private bool ShouldSend(JobAdEntry jobAd, InternalApplication application)
        {
            // Do not send an email to the job poster if the job ad is external.
            // It is assumed that submitting the external application will send them a notification.

            return(_jobAdProcessingQuery.GetJobAdProcessing(jobAd) == JobAdProcessing.ManagedInternally &&
                   !application.IsPending);
        }
Ejemplo n.º 11
0
 private static void AssertInternalApplication(InternalApplication application, bool isPending, string coverLetterText, Action <InternalApplication> assertApplication)
 {
     Assert.AreEqual(isPending, application.IsPending);
     Assert.AreEqual(coverLetterText, application.CoverLetterText);
     if (assertApplication != null)
     {
         assertApplication(application);
     }
 }
Ejemplo n.º 12
0
        private void Submit(Guid memberId, JobAdEntry jobAd)
        {
            var application = new InternalApplication {
                ApplicantId = memberId
            };

            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
        }
Ejemplo n.º 13
0
        private void SendEmailWithResumeFile(InternalApplication application, ICommunicationUser member, JobAd jobAd)
        {
            var fileReference = _filesQuery.GetFileReference(application.ResumeFileId.Value);
            var stream        = _filesQuery.OpenFile(fileReference);

            // Send the email.

            _emailsCommand.TrySend(new JobApplicationEmail(member, application, jobAd, stream, fileReference.FileName));
        }
Ejemplo n.º 14
0
        public static JobApplicationEntity Map(this InternalApplication application)
        {
            var entity = new JobApplicationEntity {
                id = application.Id
            };

            application.MapTo(entity);
            return(entity);
        }
Ejemplo n.º 15
0
        protected void SubmitApplication(IMember member, JobAdEntry jobAd)
        {
            var application = new InternalApplication {
                ApplicantId = member.Id
            };

            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
        }
Ejemplo n.º 16
0
        public void TestJobAds()
        {
            var employer = CreateEmployer(0);

            var credit = _creditsQuery.GetCredit <ContactCredit>();

            _allocationsCommand.CreateAllocation(new Allocation {
                CreditId = credit.Id, InitialQuantity = null, OwnerId = employer.Id
            });
            var jobAdCredit = _creditsQuery.GetCredit <JobAdCredit>();

            _allocationsCommand.CreateAllocation(new Allocation {
                CreditId = jobAdCredit.Id, InitialQuantity = null, OwnerId = employer.Id
            });

            // Set up members which the employer can and cannot see and add them to the shortlist folder.

            var folder    = _candidateFoldersQuery.GetShortlistFolder(employer);
            var blockList = _candidateBlockListsQuery.GetPermanentBlockList(employer);

            // Folder.
            var member = _memberAccountsCommand.CreateTestMember(0);

            for (var index = 1; index < 50; ++index)
            {
                member = _memberAccountsCommand.CreateTestMember(index);
                var candidate = _candidatesQuery.GetCandidate(member.Id);
                _candidateResumesCommand.AddTestResume(candidate);
                _employerMemberViewsCommand.AccessMember(_app, employer, _employerMemberViewsQuery.GetProfessionalView(employer, member), MemberAccessReason.Unlock);
                if (index <= 45)
                {
                    _candidateListsCommand.AddCandidateToFolder(employer, folder, member.Id);
                }
                else
                {
                    _candidateListsCommand.AddCandidateToBlockList(employer, blockList, member.Id);
                }
            }

            // Add some jobs.

            var jobAd = _jobAdsCommand.PostTestJobAd(employer, JobAdStatus.Open);

            for (var i = 0; i < 6; i++)
            {
                _jobAdsCommand.PostTestJobAd(employer, JobAdStatus.Open);
                _jobAdsCommand.PostTestJobAd(employer, JobAdStatus.Closed);
            }

            var application = new InternalApplication {
                ApplicantId = member.Id, PositionId = jobAd.Id
            };

            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
        }
Ejemplo n.º 17
0
        public void TestMix()
        {
            var employer = CreateEmployer();
            var jobAd    = _jobAdsCommand.PostTestJobAd(employer);

            // Submit some applications.

            var members = new Member[12];

            for (var index = 0; index < 5; ++index)
            {
                members[index] = _memberAccountsCommand.CreateTestMember(index);
                var application = new InternalApplication {
                    ApplicantId = members[index].Id
                };
                _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
                _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
            }

            LogIn(employer);
            AssertJobAds(jobAd.Id, 0, 5, 0);
            AssertJobAd(jobAd.Id, 0, 5, 0);

            // Add some others.

            for (var index = 5; index < 12; ++index)
            {
                members[index] = _memberAccountsCommand.CreateTestMember(index);
                AssertModel(ShortlistCandidates(jobAd.Id, members[index]), index - 5 + 1, 5, 0);
            }

            AssertJobAds(jobAd.Id, 7, 5, 0);
            AssertJobAd(jobAd.Id, 7, 5, 0);

            // Reject some.

            for (var index = 0; index < 3; ++index)
            {
                Get(GetManageCandidatesUrl(jobAd.Id));
                AssertModel(RejectCandidates(jobAd.Id, members[index]), 7, 5 - index - 1, index + 1);
            }

            AssertJobAds(jobAd.Id, 7, 2, 3);
            AssertJobAd(jobAd.Id, 7, 2, 3);

            // Shortlist others.

            for (var index = 0; index < 2; ++index)
            {
                Get(GetManageCandidatesUrl(jobAd.Id));
                AssertModel(ShortlistCandidates(jobAd.Id, members[index + 3]), 7 + index + 1, 2 - index - 1, 3);
            }

            AssertJobAds(jobAd.Id, 9, 0, 3);
            AssertJobAd(jobAd.Id, 9, 0, 3);
        }
Ejemplo n.º 18
0
        protected Application ApplyForInternalJob(JobAdEntry jobAd, Guid applicantId)
        {
            var application = new InternalApplication {
                ApplicantId = applicantId
            };

            _jobAdsApplicationSubmissionsCommand.CreateApplication(jobAd, application);
            _jobAdsApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
            return(application);
        }
Ejemplo n.º 19
0
        private void SendResumeFile(InternalApplication application, ICommunicationUser member, JobAdEntry jobAd, IEnumerable <ApplicationAnswer> answers)
        {
            // Open the file and send it.

            var resumeFileReference = _filesQuery.GetFileReference(application.ResumeFileId.Value);

            using (var stream = _filesQuery.OpenFile(resumeFileReference))
            {
                _sendJobG8Command.SendApplication(member, jobAd, resumeFileReference.FileName, new StreamFileContents(stream), application, answers);
            }
        }
Ejemplo n.º 20
0
        protected void AssertJobG8Request(Member member, JobAd jobAd, InternalApplication application)
        {
            var candidate = _candidatesQuery.GetCandidate(member.Id);
            var resume    = application.ResumeId == null || candidate.ResumeId == null
                ? null
                : _resumesQuery.GetResume(candidate.ResumeId.Value);
            var view       = new EmployerMemberView(member, candidate, resume, null, ProfessionalContactDegree.Applicant, false, false);
            var resumeFile = _resumeFilesQuery.GetResumeFile(view, resume);

            AssertJobG8Request(member, jobAd, application, resumeFile.FileName, GetResumeValue(resumeFile));
        }
Ejemplo n.º 21
0
        private Member CreateNewCandidate(JobAdEntry jobAd, int index)
        {
            var member      = CreateMember(index);
            var application = new InternalApplication {
                ApplicantId = member.Id
            };

            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
            return(member);
        }
Ejemplo n.º 22
0
 public static void MapTo(this InternalApplication application, JobApplicationEntity entity)
 {
     entity.id                     = application.Id;
     entity.applicantId            = application.ApplicantId;
     entity.coverLetterText        = application.CoverLetterText;
     entity.createdTime            = application.CreatedTime;
     entity.jobAdId                = application.PositionId;
     entity.resumeId               = application.ResumeId;
     entity.resumeAttachmentFileId = application.ResumeFileId;
     entity.isPending              = application.IsPending;
     entity.isFeatured             = application.IsPositionFeatured;
 }
Ejemplo n.º 23
0
        private void SendEmailWithResume(InternalApplication application, Member member, JobAd jobAd)
        {
            var employer   = _employersQuery.GetEmployer(jobAd.PosterId);
            var view       = _employerMemberViewsQuery.GetEmployerMemberView(employer, member);
            var resume     = application.ResumeId == null ? new Resume() : _resumesQuery.GetResume(application.ResumeId.Value);
            var resumeFile = _resumeFilesQuery.GetResumeFile(view, resume);
            var stream     = new MemoryStream(Encoding.ASCII.GetBytes(resumeFile.Contents));

            // Send the email.

            _emailsCommand.TrySend(new JobApplicationEmail(member, application, jobAd, stream, resumeFile.FileName));
        }
Ejemplo n.º 24
0
 private static void AssertApplication(InternalApplication expectedApplication, InternalApplication application)
 {
     Assert.AreEqual(expectedApplication.Id, application.Id);
     Assert.AreEqual(expectedApplication.PositionId, application.PositionId);
     Assert.AreEqual(expectedApplication.ApplicantId, application.ApplicantId);
     Assert.AreEqual(expectedApplication.ApplicantEmail, application.ApplicantEmail);
     Assert.AreEqual(expectedApplication.CoverLetterText, application.CoverLetterText);
     Assert.AreEqual(expectedApplication.IsPending, application.IsPending);
     Assert.AreEqual(expectedApplication.IsPositionFeatured, application.IsPositionFeatured);
     Assert.AreEqual(expectedApplication.ResumeFileId, application.ResumeFileId);
     Assert.AreEqual(expectedApplication.ResumeId, application.ResumeId);
 }
Ejemplo n.º 25
0
        private Member CreateRejectedCandidate(IEmployer employer, JobAdEntry jobAd, int index)
        {
            var member      = CreateMember(index);
            var application = new InternalApplication {
                ApplicantId = member.Id
            };

            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);
            _jobAdApplicationsCommand.RejectApplicants(employer, jobAd, new[] { member.Id });
            return(member);
        }
Ejemplo n.º 26
0
        private static AnswerCoverLetter GetEncodedCoverLetter(InternalApplication application)
        {
            if (string.IsNullOrEmpty(application.CoverLetterText))
            {
                return(null);
            }

            return(new AnswerCoverLetter
            {
                Filename = "Cover Letter.txt",
                Value = Convert.ToBase64String(Encoding.ASCII.GetBytes(application.CoverLetterText))
            });
        }
Ejemplo n.º 27
0
        private string GetJobApplication(InternalApplication application, Member member)
        {
            var candidate = _candidatesQuery.GetCandidate(member.Id);
            var resume    = application.ResumeId == null || candidate.ResumeId == null
                ? null
                : _resumesQuery.GetResume(candidate.ResumeId.Value);

            var file = application.ResumeFileId != null
                ? _filesQuery.GetFileReference(application.ResumeFileId.Value)
                : null;

            return(GetResponseXml(member, resume, file));
        }
Ejemplo n.º 28
0
        public void TestApplicationStatusChange()
        {
            var employer = CreateEmployer();
            var jobAd    = _jobAdsCommand.PostTestJobAd(employer);
            var list     = _jobAdApplicantsQuery.GetApplicantList(employer, jobAd);

            AssertCounts(employer, list, 0, 0, 0);
            AssertStatuses(jobAd, new Guid[0], new Guid[0], new Guid[0], new Guid[0]);

            var member      = _membersCommand.CreateTestMember(1);
            var application = new InternalApplication {
                ApplicantId = member.Id
            };

            _jobAdApplicationSubmissionsCommand.CreateApplication(jobAd, application);
            _jobAdApplicationSubmissionsCommand.SubmitApplication(jobAd, application);

            // Ensure initially new.

            AssertCounts(employer, list, 1, 0, 0);
            AssertStatuses(jobAd, new[] { member.Id }, new Guid[0], new Guid[0], new Guid[0]);
            AssertApplication(employer, member.Id, jobAd);

            // Try to shortlist.

            _jobAdApplicantsCommand.ShortlistApplicants(employer, jobAd, new[] { member.Id });
            AssertCounts(employer, list, 0, 1, 0);
            AssertStatuses(jobAd, new Guid[0], new[] { member.Id }, new Guid[0], new Guid[0]);
            AssertApplication(employer, member.Id, jobAd);

            // Try to reject.

            _jobAdApplicantsCommand.RejectApplicants(employer, jobAd, new[] { member.Id });
            AssertCounts(employer, list, 0, 0, 1);
            AssertStatuses(jobAd, new Guid[0], new Guid[0], new[] { member.Id }, new Guid[0]);
            AssertApplication(employer, member.Id, jobAd);

            // Try to remove.

            _jobAdApplicantsCommand.RemoveApplicants(employer, jobAd, new[] { member.Id });
            AssertCounts(employer, list, 0, 0, 0);
            AssertStatuses(jobAd, new Guid[0], new Guid[0], new Guid[0], new[] { member.Id });
            AssertApplication(employer, member.Id, jobAd);

            // Attempt to re-shortlist.

            _jobAdApplicantsCommand.ShortlistApplicants(employer, jobAd, new[] { member.Id });
            AssertCounts(employer, list, 0, 1, 0);
            AssertStatuses(jobAd, new Guid[0], new[] { member.Id }, new Guid[0], new Guid[0]);
            AssertApplication(employer, member.Id, jobAd);
        }
Ejemplo n.º 29
0
        public void TestUnknownApplication()
        {
            var integratorUser = _integrationCommand.CreateTestIntegratorUser();

            // Apply.

            var application = new InternalApplication
            {
                Id = Guid.NewGuid(),
            };

            // Set status.

            AssertErrors(SetJobApplicationsStatus(integratorUser, application), 0, 1, "There is no job application with ID {" + application.Id + "}.");
        }
Ejemplo n.º 30
0
        private static void SetJobApplicationStatus(InternalApplication application, ICollection <Application> toUpdate, ref int updated)
        {
            // OK, this job application status can be updated.

            if (application.IsPending)
            {
                application.IsPending = false;
                toUpdate.Add(application);
                updated++;
            }
            else
            {
                updated++; // Already submitted, OK.
            }
        }