コード例 #1
0
        private void TestSearch(JobAdSearchCriteria criteria, ICollection <string> expectedTitles)
        {
            var execution = _executeJobAdSearchCommand.Search(null, criteria, null);

            Assert.AreEqual(expectedTitles.Count, execution.Results.TotalMatches);
            Assert.AreEqual(expectedTitles.Count, execution.Results.JobAdIds.Count);

            foreach (var expectedTitle in expectedTitles)
            {
                var found = false;
                foreach (var jobAdId in execution.Results.JobAdIds)
                {
                    var jobAd = _jobAdsCommand.GetJobAd <JobAdEntry>(jobAdId);
                    if (jobAd.Title == expectedTitle)
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    Assert.Fail("Could not find job with title '" + expectedTitle + "'.");
                }
            }
        }
コード例 #2
0
ファイル: JobAdFacade.cs プロジェクト: formist/LinkMe
        public static void SendJobAdEmailToFriend(string senderName, string senderEmail, string recipientName, string recipientEmail, string userMessage, string adId)
        {
            var ad    = _jobAdsCommand.GetJobAd <JobAdEntry>(new Guid(adId));
            var email = new SendJobToFriendEmail(recipientEmail, recipientName, senderEmail, senderName, ad, userMessage);

            Container.Current.Resolve <IEmailsCommand>().TrySend(email);
        }
コード例 #3
0
        public void TestGetExpiredJobAds()
        {
            var employer = CreateEmployer();

            // Create an open job ad.

            var activeJobAd = _jobAdsCommand.PostTestJobAd(employer);

            // Create an open job ad that has expired.

            var expiredJobAd = employer.CreateTestJobAd();

            _jobAdsCommand.PostJobAd(expiredJobAd);
            expiredJobAd.ExpiryTime = DateTime.Now.AddDays(-1);
            _jobAdsCommand.UpdateJobAd(expiredJobAd);

            Assert.AreEqual(JobAdStatus.Open, activeJobAd.Status);
            Assert.AreEqual(JobAdStatus.Open, expiredJobAd.Status);

            // Get the expired job ads.

            var ids = _jobAdsQuery.GetExpiredJobAdIds();

            Assert.AreEqual(1, ids.Count);
            Assert.AreEqual(expiredJobAd.Id, ids[0]);

            // Close them.

            foreach (var id in ids)
            {
                var closeJobAd = _jobAdsQuery.GetJobAd <JobAdEntry>(id);
                _jobAdsCommand.CloseJobAd(closeJobAd);
            }

            // Check the status.

            var jobAd = _jobAdsCommand.GetJobAd <JobAdEntry>(activeJobAd.Id);

            Assert.AreEqual(JobAdStatus.Open, jobAd.Status);
            jobAd = _jobAdsCommand.GetJobAd <JobAdEntry>(expiredJobAd.Id);
            Assert.AreEqual(JobAdStatus.Closed, jobAd.Status);

            // Do it again.

            Assert.AreEqual(0, _jobAdsQuery.GetExpiredJobAdIds().Count);
        }
コード例 #4
0
        string IJobAdApplicationsManager.GetJobApplication(IntegratorUser integratorUser, Guid applicationId, List <string> errors)
        {
            var application = _memberApplicationsQuery.GetInternalApplication(applicationId);

            if (application == null)
            {
                errors.Add("There is no job application with ID '" + applicationId + "'.");
                return(null);
            }

            var jobAd = _jobAdsCommand.GetJobAd <JobAdEntry>(application.PositionId);

            if (jobAd.Integration.IntegratorUserId != integratorUser.Id)
            {
                errors.Add(string.Format("Job application {0:b} is for a job not posted by the current integrator user, '{1}'.", application.Id, integratorUser.LoginId));
                return(null);
            }

            // Determine whether it is a member or anonymous user application.

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

            if (member != null)
            {
                return(GetJobApplication(application, member));
            }

            var contact = _anonymousUsersQuery.GetContact(application.ApplicantId);

            if (contact != null)
            {
                return(GetJobApplication(application, contact));
            }

            errors.Add("There is no job application with ID '" + applicationId + "'.");
            return(null);
        }
コード例 #5
0
ファイル: PostTests.cs プロジェクト: formist/LinkMe
        public void TestDuplicateAdHasPriorityOverCareerOne()
        {
            const string integratorReferenceId = "RefABCD/1235";
            const string externalReferenceId   = "RefABCD";

            // Create another job ad with the same title and external reference ID.

            var employer      = CreateEmployer(0);
            var otherEmployer = CreateEmployer(1);

            var otherJobAd = otherEmployer.CreateTestJobAd("Chartered Accountant");

            otherJobAd.Integration.ExternalReferenceId = externalReferenceId;
            otherJobAd.Integration.IntegratorUserId    = _careerOneQuery.GetIntegratorUser().Id;
            _jobAdsCommand.PostJobAd(otherJobAd);

            // Post the JobG8 as as normal.

            var request = new PostAdvertRequestMessage
            {
                UserCredentials = new Credentials
                {
                    Username = _jobG8Query.GetIntegratorUser().LoginId,
                    Password = Password
                },
                PostAdvert = new PostAdvertRequest
                {
                    Adverts = new PostAdverts
                    {
                        AccountNumber = employer.GetLoginId(),
                        PostAdvert    = new[]
                        {
                            new PostAdvert
                            {
                                JobReference      = integratorReferenceId,
                                ClientReference   = externalReferenceId,
                                Classification    = "Accounting",
                                SubClassification = "Accountant",
                                Position          = "Chartered Accountant",
                                Description       = "<p><b><u>Tired of searching for perfect employment? Looking for a fresh start at a new company? </u></b></p>",
                                Location          = "Sydney",
                                Area           = "Sydney Inner",
                                PostCode       = "2000",
                                Country        = "Australia",
                                EmploymentType = EmploymentType.Permanent,
                                VisaRequired   = VisaRequired.MustBeEligible,
                                PayPeriod      = PayPeriod.Annual,
                                PayAmount      = 100000, PayAmountSpecified = true,
                                Currency       = "AUS",
                                Contact        = "John Bloomfield",
                            }
                        }
                    }
                }
            };

            // Check that it was still posted.

            var response = PostAdvert(employer, request);

            Assert.AreEqual(response, "");
            AssertJobAd(employer.Id);

            // Check that the job ad was posted.

            var jobG8IntegratorUser = _jobG8Query.GetIntegratorUser();
            var jobAd = _jobAdsCommand.GetJobAd <JobAdEntry>(_jobAdIntegrationQuery.GetJobAdIds(jobG8IntegratorUser.Id, employer.Id, otherJobAd.Integration.ExternalReferenceId)[0]);

            Assert.AreEqual(jobG8IntegratorUser.Id, jobAd.Integration.IntegratorUserId);
            Assert.AreEqual(integratorReferenceId, jobAd.Integration.IntegratorReferenceId);
            Assert.AreEqual(externalReferenceId, jobAd.Integration.ExternalReferenceId);
            Assert.AreEqual(JobAdStatus.Open, jobAd.Status);

            // Check that the other job ad was closed.

            jobAd = _jobAdsCommand.GetJobAd <JobAdEntry>(otherJobAd.Id);
            Assert.AreNotEqual(jobG8IntegratorUser.Id, jobAd.Integration.IntegratorUserId);
            Assert.AreNotEqual(integratorReferenceId, jobAd.Integration.IntegratorReferenceId);
            Assert.AreEqual(externalReferenceId, jobAd.Integration.ExternalReferenceId);
            Assert.AreEqual(JobAdStatus.Closed, jobAd.Status);
        }