示例#1
0
        public void TestResultsNoLocation()
        {
            // Create a member and search.

            var member = CreateMember();
            var search = CreateSearch(member.Id, JobTitle, null, null, null, null, JobTypes.None);

            // No location.

            var employer = CreateEmployer();
            var jobAd    = _jobAdsCommand.PostTestJobAd(employer);

            jobAd.Description.Location = null;
            _jobAdsCommand.UpdateJobAd(jobAd);
            search.Results = new JobAdSearchResults {
                TotalMatches = 1, JobAdIds = new List <Guid> {
                    jobAd.Id
                }
            };

            // Send.

            var templateEmail = SendIt(member, search, true);

            // Check.

            var bodyTemplate = File.ReadAllText(FileSystem.GetAbsolutePath(@"Apps\Agents\Test\Communications\Emails\MemberAlerts\TestResultsNoLocation.htm", RuntimeEnvironment.GetSourceFolder()));

            AssertMail(templateEmail, member, search, bodyTemplate);
        }
示例#2
0
        protected JobAd PostJobAd(IEmployer employer, IntegratorUser integratorUser, string companyName, string contactCompanyName, bool hideContactDetails, bool hideCompany)
        {
            var jobAd = PostJobAd(employer);

            jobAd.ContactDetails = new ContactDetails
            {
                FirstName               = FirstName,
                LastName                = LastName,
                CompanyName             = contactCompanyName,
                EmailAddress            = EmailAddress,
                FaxNumber               = FaxNumber,
                PhoneNumber             = PhoneNumber,
                SecondaryEmailAddresses = SecondaryEmailAddresses
            };
            jobAd.Description.CompanyName = companyName;

            jobAd.Visibility.HideContactDetails = hideContactDetails;
            jobAd.Visibility.HideCompany        = hideCompany;

            if (integratorUser != null)
            {
                jobAd.Integration.IntegratorUserId = integratorUser.Id;
            }

            _jobAdsCommand.UpdateJobAd(jobAd);
            return(jobAd);
        }
示例#3
0
        private void AddLogo(JobAd jobAd, bool hasLogoFeature)
        {
            var fileReference = _filesCommand.CreateTestPhoto(0, FileType.CompanyLogo);

            jobAd.LogoId   = fileReference.Id;
            jobAd.Features = hasLogoFeature ? JobAdFeatures.Logo : JobAdFeatures.None;
            _jobAdsCommand.UpdateJobAd(jobAd);
        }
示例#4
0
        protected virtual JobAd CreateJobAd(IEmployer employer)
        {
            var jobAd = _jobAdsCommand.PostTestJobAd(employer);

            jobAd.ContactDetails.CompanyName = ContactCompanyName;
            jobAd.Description.CompanyName    = EmployerCompanyName;
            _jobAdsCommand.UpdateJobAd(jobAd);
            return(jobAd);
        }
示例#5
0
        void IAnonymousJobAdsCommand.UpdateJobAd(AnonymousUser user, JobAd jobAd)
        {
            if (!CanAccess(user, jobAd))
            {
                throw new JobAdPermissionsException(user, jobAd.Id);
            }

            _jobAdsCommand.UpdateJobAd(jobAd);
        }
示例#6
0
        void IEmployerJobAdsCommand.UpdateJobAd(IEmployer employer, JobAd jobAd)
        {
            if (!CanAccess(employer, jobAd))
            {
                throw new JobAdPermissionsException(employer, jobAd.Id);
            }

            _jobAdsCommand.UpdateJobAd(jobAd);
        }
示例#7
0
        private JobAdEntry PostExpiryJobAd(IEmployer employer, DateTime createdTime, DateTime expiryTime)
        {
            var jobAd = employer.CreateTestJobAd(BusinessAnalyst);

            jobAd.CreatedTime = createdTime;
            _jobAdsCommand.PostJobAd(jobAd);
            jobAd.ExpiryTime = expiryTime;
            _jobAdsCommand.UpdateJobAd(jobAd);
            return(jobAd);
        }
示例#8
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);
        }
示例#9
0
        public void ParseJobAdSalaries(bool limitToOpenJobAds)
        {
            var jobAdIds = limitToOpenJobAds
                ? _jobAdsQuery.GetOpenJobAdsWithoutSalaries()
                : _jobAdsQuery.GetJobAdsWithoutSalaries();

            if (jobAdIds == null || jobAdIds.Count == 0)
            {
                return;
            }

            foreach (var id in jobAdIds)
            {
                var jobAd = _jobAdsQuery.GetJobAd <JobAd>(id);

                var parsedSalary = new Salary
                {
                    Currency = Currency.AUD,
                    Rate     = SalaryRate.Year
                };

                ParseSalaryFromText(jobAd.Description.Content, ref parsedSalary);

                if (parsedSalary == null || parsedSalary.IsEmpty)
                {
                    ParseSalaryFromText(jobAd.Title, ref parsedSalary);
                }

                if (parsedSalary == null || parsedSalary.IsEmpty)
                {
                    continue;
                }

                if (!ReasonableSalary(parsedSalary))
                {
                    continue;
                }

                jobAd.Description.ParsedSalary = parsedSalary;
                _jobAdsCommand.UpdateJobAd(jobAd);
            }
        }
示例#10
0
        public void TestCareerOneJobAd()
        {
            var integratorUser = _integrationCommand.CreateTestIntegratorUser();
            var employer = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0));
            var jobAd = PostJobAd(employer);

            // Get.

            var response = JobAdIds(integratorUser);
            Assert.AreEqual(jobAd.Id, GetJobAdId(response));

            // Make it a CareerOne job ad.

            jobAd.Integration.IntegratorUserId = _careerOneQuery.GetIntegratorUser().Id;
            _jobAdsCommand.UpdateJobAd(jobAd);

            // Should still be returned.

            response = JobAdIds(integratorUser);
            Assert.AreEqual(jobAd.Id, GetJobAdId(response));
        }
示例#11
0
        public void TestCareerOneJobAd()
        {
            var integratorUser = _integrationCommand.CreateTestIntegratorUser();
            var employer       = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0));
            var jobAd          = PostJobAd(employer);

            // Get.

            var response = JobAds(integratorUser, jobAd.Description.Industries[0].Name);

            AssertJobAdFeed(employer, jobAd, GetJobAdFeed(response));

            // Make it a CareerOne job ad.

            jobAd.Integration.IntegratorUserId = _careerOneQuery.GetIntegratorUser().Id;
            _jobAdsCommand.UpdateJobAd(jobAd);

            // Should still be returned but contact details are not shown.

            response             = JobAds(integratorUser, jobAd.Description.Industries[0].Name);
            jobAd.ContactDetails = null;
            AssertJobAdFeed(employer, jobAd, GetJobAdFeed(response));
        }
示例#12
0
        protected Guid PreLoadJobAds()
        {
            const string jobPosterFax   = "0385089191";
            const string jobPosterPhone = "0385089111";

            var contact1 = new ContactDetails {
                FirstName = "Karl", LastName = "Heinz", EmailAddress = "*****@*****.**", SecondaryEmailAddresses = null, FaxNumber = jobPosterFax, PhoneNumber = jobPosterPhone
            };
            var contact2 = new ContactDetails {
                FirstName = null, LastName = null, EmailAddress = "*****@*****.**", SecondaryEmailAddresses = null, FaxNumber = null, PhoneNumber = ""
            };

            var employer = _employerAccountsQuery.GetEmployer(TestEmployerUserId);

            var industries = Resolve <IIndustriesQuery>().GetIndustries();

            var melbourne = new LocationReference();

            _locationQuery.ResolveLocation(melbourne, Australia, "3000");

            // load job ads

            var newJobAd1 = CreateNewJobAd("Amazing opportunity joining a reknowned company",
                                           JobAdStatus.Open,
                                           employer, false, contact1,
                                           "1st summary",
                                           "bulletpoint1", "bulletpoint2",
                                           "bulletpoint3", null,
                                           "Biz Analyst",
                                           "Biz Analyst",
                                           JobTypes.FullTime, true,
                                           "Ref01",
                                           string.Empty, "45000",
                                           "car",
                                           new List <Industry> {
                industries[0], industries[1]
            },
                                           "BMW", melbourne.Clone(),
                                           DateTime.Now.AddDays(20));
            Guid jobAdId1 = newJobAd1.Id;

            newJobAd1.Integration.ExternalReferenceId =
                string.Format("ref{0}:{1}:{2}", DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Millisecond);

            var newJobAd2 = CreateNewJobAd("Work with the best", JobAdStatus.Open,
                                           employer, false, contact2,
                                           "2ND SUMMARY",
                                           "BULLETPOINT1", "BULLETPOINT2",
                                           "BULLETPOINT3", null,
                                           "Experienced Team Leader Required - top $$$",
                                           "Project Leader",
                                           JobTypes.Contract, false,
                                           "REF02",
                                           "90000", "80000",
                                           "MOBILE PHONE",
                                           new List <Industry> {
                industries[2], industries[3]
            },
                                           "TOYOTA", melbourne.Clone(), DateTime.Now.AddDays(30));

            newJobAd2.Integration.ExternalReferenceId =
                string.Format("ref{0}:{1}:{2}", DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Millisecond);
            newJobAd2.LastUpdatedTime = DateTime.Now.AddDays(5);

            _jobAdsCommand.UpdateJobAd(newJobAd2);

            return(jobAdId1);
        }
示例#13
0
        public AmendAdvertResponseMessage AmendAdvert(AmendAdvertRequestMessage request)
        {
            const string method = "AmendAdvert";

            EventSource.Raise(Event.Information, method, Event.Arg("request", request));

            IntegratorUser integratorUser;
            IEmployer      jobPoster;

            CheckUser(request.UserCredentials, out integratorUser, out jobPoster);

            var errors = new List <string>();
            var report = new AmendAdvertReport();

            foreach (var amendAd in request.AmendAdvert.Adverts.AmendAdvert)
            {
                report.JobAds++;

                try
                {
                    var jobAd = _externalJobAdsCommand.GetExistingJobAd(integratorUser.Id, amendAd.JobReference);
                    if (jobAd != null)
                    {
                        MapJobAd(amendAd, jobAd);

                        // Make sure the job is open.

                        _jobAdsCommand.UpdateJobAd(jobAd);
                        _jobAdsCommand.OpenJobAd(jobAd);

                        report.Updated++;
                    }
                    else
                    {
                        EventSource.Raise(Event.Warning, method, "Job ad not found. No action has been taken.", Event.Arg("amendAd", amendAd));
                    }
                }
                catch (ServiceEndUserException e)
                {
                    EventSource.Raise(Event.Error, method, e, null, Event.Arg("amendAd", amendAd));
                    errors.Add(string.Format("JobReference='{0}': {1}", amendAd.JobReference, e.Message));
                    report.Failed++;
                }
                catch (Exception e)
                {
                    EventSource.Raise(Event.Error, method, e, null, Event.Arg("amendAd", amendAd));
                    errors.Add(string.Format("JobReference='{0}': Unexpected error.", amendAd.JobReference));
                    report.Failed++;
                }
            }

            // Record it.

            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(new JobAdImportPostEvent {
                Success = true, IntegratorUserId = integratorUser.Id, PosterId = jobPoster.Id, JobAds = report.JobAds, Closed = 0, Failed = report.Failed, Posted = 0, Updated = report.Updated
            });

            var response = new AmendAdvertResponseMessage
            {
                AmendAdvertResponse = new Response {
                    Success = string.Join("\r\n", errors.ToArray())
                }
            };

            EventSource.Raise(Event.Information, method, Event.Arg("response", response));
            return(response);
        }