Пример #1
0
        public void TestAnonymousSavedDefault()
        {
            Get(HomeUrl);
            var anonymousId = GetAnonymousId();

            var jobAd = new JobAd
            {
                PosterId    = anonymousId,
                Title       = DefaultTitle,
                Description =
                {
                    Content = DefaultContent,
                },
            };

            _jobPostersCommand.CreateJobPoster(new JobPoster {
                Id = anonymousId
            });
            _jobAdsCommand.CreateJobAd(jobAd);

            // Check.

            Get(GetJobAdUrl(jobAd.Id));
            AssertJobAd(jobAd);
        }
Пример #2
0
        protected string GetApplicantsActionItem(JobAd ad)
        {
            if (!HaveCandidates(LoggedInEmployer, ad))
            {
                return(string.Empty);
            }

            var hypertext = new TagBuilder("a");

            hypertext.AddCssClass("execute-job-ad-action");
            var status = ApplicantStatus.New;

            if (GetCountsForJobAd(LoggedInEmployer, ad)[ApplicantStatus.New] == 0)
            {
                if (GetCountsForJobAd(LoggedInEmployer, ad)[ApplicantStatus.Shortlisted] == 0)
                {
                    status = GetCountsForJobAd(LoggedInEmployer, ad)[ApplicantStatus.Rejected] == 0 ? ApplicantStatus.New : ApplicantStatus.Rejected;
                }
                else
                {
                    status = ApplicantStatus.Shortlisted;
                }
            }

            hypertext.MergeAttribute("href", GetApplicantsUrl(ad, status).ToString());
            hypertext.MergeAttribute("title", "See the applicants for this job ad");
            hypertext.SetInnerText("Manage applicants");
            return(string.Concat("<li>", hypertext.ToString(), "</li>"));
        }
Пример #3
0
        private void AddLogo(JobAd jobAd)
        {
            var filePath = FileSystem.GetAbsolutePath(@"Test\Data\Photos\ProfilePhoto.jpg", RuntimeEnvironment.GetSourceFolder());

            using (var stream = new MemoryStream())
            {
                using (var writer = new BinaryWriter(stream))
                {
                    // Load the contents from the file.

                    using (var reader = new BinaryReader(File.OpenRead(filePath)))
                    {
                        var count  = 4096;
                        var buffer = new byte[count];
                        while ((count = reader.Read(buffer, 0, count)) > 0)
                        {
                            writer.Write(buffer, 0, count);
                        }
                    }

                    stream.Position = 0;
                    var fileReference = _filesCommand.SaveFile(FileType.CompanyLogo, new StreamFileContents(stream), Path.GetFileName(filePath));

                    jobAd.LogoId = fileReference.Id;
                    _jobAdsCommand.UpdateJobAd(jobAd);
                }
            }
        }
Пример #4
0
        private JobAd CreateJobAd(IEmployer employer, AnonymousUser anonymousUser, JobAdModel jobAdModel, HttpPostedFileBase logo, Guid?logoId)
        {
            CreateLogo(jobAdModel, logo, logoId);

            // Prepare it first.

            jobAdModel.Prepare();

            // Update a new instance.

            var jobAd = new JobAd();

            UpdateJobAd(jobAd, jobAdModel);

            // Create the job ad.

            if (employer != null)
            {
                _employerJobAdsCommand.CreateJobAd(employer, jobAd);
            }
            else
            {
                _anonymousJobAdsCommand.CreateJobAd(anonymousUser, jobAd);
            }

            return(jobAd);
        }
Пример #5
0
        private void Update(long vacancyId, JobAd jobAd)
        {
            const string method = "Update";

            // Update.

            var channel = _channelManager.Create();

            var request = new UpdateVacancyRequestMessage {
                Body = _mapper.CreateUpdateRequestBody(jobAd)
            };

            request.Body.vacancyID = vacancyId;

            var controlNumbers = GetControlNumbers(channel, vacancyId);

            request.Body.integrityControlNumber               = controlNumbers.integrityControlNumber;
            request.Body.contactIntegrityControlNumber        = controlNumbers.contactIntegrityControlNumber;
            request.Body.contactAddressIntegrityControlNumber = controlNumbers.contactAddressIntegrityControlNumber;
            request.Body.detailsIntegrityControlNumber        = controlNumbers.detailsIntegrityControlNumber;
            request.Body.agentIntegrityControlNumber          = controlNumbers.agentIntegrityControlNumber;

            SetSecurity(request);

            UpdateVacancyResponseMessage response;

            try
            {
                response = channel.UpdateVacancy(request);
            }
            catch (Exception)
            {
                _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(new JobAdExportPostEvent {
                    Success = false, IntegratorUserId = _integratorUser.Id, Failed = 1, JobAds = 1
                });
                _channelManager.Abort(channel);
                throw;
            }

            _channelManager.Close(channel);

            if (response.Header.executionStatus == EsiExecutionStatus.Failed)
            {
                _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(new JobAdExportPostEvent {
                    Success = false, IntegratorUserId = _integratorUser.Id, Failed = 1, JobAds = 1
                });

                #region Log

                Logger.Raise(Event.Error, method, response.Body.ErrorString,
                             Event.Arg("jobAdId", jobAd.Id),
                             Event.Arg("messages", Array.ConvertAll(response.Header.Messages, m => m.text)));

                #endregion
            }

            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(new JobAdExportPostEvent {
                Success = true, IntegratorUserId = _integratorUser.Id, Updated = 1, JobAds = 1
            });
        }
Пример #6
0
        public UpdateVacancyRequestBody CreateUpdateRequestBody(JobAd jobAd)
        {
            var body = new UpdateVacancyRequestBody
            {
                vacancyTitle       = jobAd.Title,
                vacancyDescription = _contentMapper.MapBody(jobAd.Id, jobAd.Description.BulletPoints, jobAd.Description.Content),
                positionLimit      = 1,
                daysToExpiry       = Math.Min(GetDaysUntilExpiry(jobAd), MaximumExpiryDays),
                howToApplyCode     = "PSD",
                vacancyType        = "H",
                contactName        = jobAd.Visibility.HideContactDetails || string.IsNullOrEmpty(jobAd.ContactDetails.FullName) ? "<Hidden>" : jobAd.ContactDetails.FullName, //ContactName is compulsory
                occupationCode     = _occupationMapper.Map(jobAd).ToString(CultureInfo.InvariantCulture)
            };

            jobAd.Description.Location.Map(out body.stateCode, out body.vacancyPostcode, out body.vacancySuburb);
            jobAd.Description.JobTypes.Map(out body.workType, out body.duration);
            jobAd.ContactDetails.MapPhoneNumber(jobAd.Visibility.HideContactDetails, out body.contactPhoneAreaCode, out body.contactPhoneNumber);

            if (jobAd.Description.Salary != null)
            {
                body.salary = jobAd.Description.Salary.GetDisplayText();
            }

            return(body);
        }
Пример #7
0
        public void TestAddIndustries()
        {
            var employer   = CreateEmployer();
            var industries = _industriesQuery.GetIndustries();

            // No industries.

            var jobAd = new JobAd
            {
                PosterId    = employer.Id,
                Title       = string.Format(TitleFormat, 0),
                Description =
                {
                    Content = string.Format(ContentFormat, 1),
                }
            };

            _jobAdsCommand.CreateJobAd(jobAd);

            AssertIndustries(jobAd.Description.Industries, _jobAdsQuery.GetJobAd <JobAd>(jobAd.Id).Description.Industries);

            // Add industries.

            jobAd.Description.Industries = new List <Industry> {
                industries[2]
            };
            _jobAdsCommand.UpdateJobAd(jobAd);

            AssertIndustries(jobAd.Description.Industries, _jobAdsQuery.GetJobAd <JobAd>(jobAd.Id).Description.Industries);
        }
Пример #8
0
 private static void AssertJobAd(JobAd expectedJobAd, JobAd jobAd)
 {
     Assert.AreEqual(expectedJobAd.Id, jobAd.Id);
     Assert.AreEqual(expectedJobAd.PosterId, jobAd.PosterId);
     Assert.AreEqual(expectedJobAd.Title, jobAd.Title);
     Assert.AreEqual(expectedJobAd.Description.Content, jobAd.Description.Content);
 }
Пример #9
0
 protected override void AssertSavedValue(JobAd jobAd)
 {
     Assert.AreEqual(3, jobAd.Description.BulletPoints.Count);
     Assert.AreEqual(string.Format(BulletPointFormat, 1), jobAd.Description.BulletPoints[0]);
     Assert.AreEqual(string.Format(BulletPointFormat, 2), jobAd.Description.BulletPoints[1]);
     Assert.AreEqual(string.Format(BulletPointFormat, 3), jobAd.Description.BulletPoints[2]);
 }
Пример #10
0
 public MemberJobAdView(JobAd jobAd, JobAdProcessing processing, ContactDetails contactDetails, string companyName, bool hasViewed, bool hasApplied, bool isFlagged, bool isInMobileFolder)
     : base(jobAd, processing)
 {
     _description    = new MemberJobAdDescriptionView(jobAd, companyName);
     _applicant      = new JobAdApplicantView(hasViewed, hasApplied, isFlagged, isInMobileFolder);
     _contactDetails = contactDetails;
 }
Пример #11
0
        private JobAd CreateJobAd(int index)
        {
            var jobAd = new JobAd
            {
                Id             = Guid.NewGuid(),
                Status         = JobAdStatus.Open,
                Title          = string.Format("Job Ad {0}", index),
                CreatedTime    = DateTime.Now.AddDays(-100),
                JobDescription = new JobDescription
                {
                    BulletPoints = new[] { "good verbal communication", "self management and independency", "bullet point 3" },
                    Content      =
                        "Mutley, you snickering, floppy eared hound. When courage is needed, you're never around.",
                    JobTypes   = JobTypes.FullTime,
                    Industries = new List <Industry> {
                        _industriesQuery.GetIndustry("Engineering")
                    },
                    Location = new LocationReference(_locationQuery.GetCountrySubdivision(_australia, "QLD")),
                }
            };

            _jobAdsCommand.CreateJobAd(jobAd);

            return(jobAd);
        }
Пример #12
0
        public void TestSomeJobAds()
        {
            var employer = CreateEmployer();

            const int count  = 3;
            var       jobAds = new JobAd[count];

            for (var index = 0; index < count; ++index)
            {
                jobAds[index] = CreateJobAd(employer, j => j.CreatedTime = DateTime.Now.AddDays(-1 * index));
            }

            // Create employer and folder.

            var member = CreateMember();
            var folder = _jobAdFoldersQuery.GetMobileFolder(member);

            _memberJobAdListsCommand.AddJobAdsToFolder(member, folder, from j in jobAds select j.Id);

            LogIn(member);
            Get(_mobileFolderUrl);
            AssertUrl(_mobileFolderUrl);

            AssertPageDoesNotContain("You have no saved jobs.");
            AssertMobileJobAds(jobAds);
        }
Пример #13
0
        string IJobAdHighlighter.SummarizeContent(JobAd jobAd)
        {
            if (jobAd == null || _contentQuery == null)
            {
                return(string.Empty);
            }

            if (jobAd.Description.BulletPoints.Count == 0)
            {
                //add two more fragments in place of the "missing" bullet points
                _configuration.MaxFragments += 2;
            }

            var highlightedString = Summarize(_contentQuery, jobAd.Description.Summary, true);

            if (!string.IsNullOrEmpty(highlightedString) && highlightedString.Contains(_configuration.StartTag))
            {
                //some highlighting occured - return this string
                return(highlightedString);
            }

            highlightedString = Summarize(_contentQuery, jobAd.Description.Content, true);
            if (!string.IsNullOrEmpty(highlightedString) && highlightedString.Contains(_configuration.StartTag))
            {
                //some highlighting occured - return this string
                return(highlightedString);
            }

            return(string.Empty);
        }
Пример #14
0
        public void TestEmployerSaveErrors()
        {
            var employer = CreateEmployer(null);

            LogIn(employer);

            var jobAd = new JobAd
            {
                Title       = DefaultTitle,
                Description =
                {
                    Content    = DefaultContent,
                    Industries = new[] { _accounting },
                    JobTypes   = JobTypes.FullTime,
                    Location   = _locationQuery.ResolveLocation(_locationQuery.GetCountry(DefaultCountry), DefaultLocation),
                },
                ContactDetails = new ContactDetails
                {
                    EmailAddress = employer.EmailAddress.Address,
                },
            };

            _employerJobAdsCommand.CreateJobAd(employer, jobAd);

            // Check.

            TestErrorValues(true, jobAd.Id);
        }
Пример #15
0
        public static void PostJobAd(this IJobAdsCommand jobAdsCommand, JobAd jobAd)
        {
            // Creating the job ad puts it into the Draft state so open it as well.

            jobAdsCommand.CreateJobAd(jobAd);
            jobAdsCommand.OpenJobAd(jobAd);
        }
Пример #16
0
 protected void AssertCandidates(JobAd jobAd, Member[] expectedNewMembers, Member[] expectedShortlistedMembers, Member[] expectedRejectedMembers, Member[] expectedRemovedMembers)
 {
     AssertCandidates(expectedNewMembers, _jobAdApplicantsQuery.GetApplicantIds(jobAd.Id, ApplicantStatus.New));
     AssertCandidates(expectedShortlistedMembers, _jobAdApplicantsQuery.GetApplicantIds(jobAd.Id, ApplicantStatus.Shortlisted));
     AssertCandidates(expectedRejectedMembers, _jobAdApplicantsQuery.GetApplicantIds(jobAd.Id, ApplicantStatus.Rejected));
     AssertCandidates(expectedRemovedMembers, _jobAdApplicantsQuery.GetApplicantIds(jobAd.Id, ApplicantStatus.Removed));
 }
Пример #17
0
        public AddVacancyRequestBody CreateAddRequestBody(JobAd jobAd)
        {
            var body = new AddVacancyRequestBody
            {
                vacancyTitle       = _contentMapper.MapTitle(jobAd.Title),
                vacancyDescription = _contentMapper.MapBody(jobAd.Id, jobAd.Description.BulletPoints, jobAd.Description.Content),
                positionLimit      = 1,
                daysToExpiry       = Math.Min(GetDaysUntilExpiry(jobAd), MaximumExpiryDays),
                howToApplyCode     = "PSD",                                                                                                                                   //Please See Description
                vacancyType        = "H",                                                                                                                                     //Normal Internet Vacancy
                contactName        = jobAd.Visibility.HideContactDetails || string.IsNullOrEmpty(jobAd.ContactDetails.FullName) ? "<Hidden>" : jobAd.ContactDetails.FullName, //ContactName is compulsory
                returnMatchesFlag  = false,
                yourReference      = string.Empty,                                                                                                                            //MUST specify empty string. NULL is not allowed
            };

            jobAd.ContactDetails.MapPhoneNumber(jobAd.Visibility.HideContactDetails, out body.contactPhoneAreaCode, out body.contactPhoneNumber);
            jobAd.Description.Location.Map(out body.stateCode, out body.vacancyPostcode, out body.vacancySuburb);
            jobAd.Description.JobTypes.Map(out body.workType, out body.duration);

            if (jobAd.Description.Salary != null)
            {
                body.salary = jobAd.Description.Salary.GetDisplayText();
            }

            body.occupationCode = _occupationMapper.Map(jobAd).ToString(CultureInfo.InvariantCulture);

            return(body);
        }
Пример #18
0
        public static string GetPostedDisplayText(this JobAd jobAd)
        {
            var age = DateTime.Now - jobAd.CreatedTime;

            string rez;

            if (age.Days > 0)
            {
                var text = age.Days + (age.Days == 1 ? " day" : " days");
                if (age.Hours > 0)
                {
                    text += string.Format(" {0} {1}", age.Hours, (age.Hours == 1 ? " hour" : " hours"));
                }
                rez = text + " ago";
            }
            else if (age.Hours > 0)
            {
                rez = age.Hours + (age.Hours == 1 ? " hour" : " hours") + " ago";
            }
            else
            {
                rez = "less than an hour ago";
            }

            return("Posted " + rez);
        }
Пример #19
0
        private JobAd CreateJobAd(IHasId <Guid> employer, JobAdStatus status)
        {
            var jobAd = new JobAd
            {
                Id          = Guid.NewGuid(),
                Status      = status,
                Title       = "Best Job in the World",
                CreatedTime = DateTime.Now,
                PosterId    = employer.Id,
                Description =
                {
                    BulletPoints = new[]               { "good verbal communication", "self management and independency", "bullet point 3" },
                    Content      = "Mutley, you snickering, floppy eared hound. When courage is needed, you're never around.",
                    JobTypes     = JobTypes.FullTime,
                    Industries   = new List <Industry> {
                        _industriesQuery.GetIndustry("Engineering")
                    },
                },
            };

            _jobAdsCommand.CreateJobAd(jobAd);
            _jobAdsCommand.OpenJobAd(jobAd);
            if (status == JobAdStatus.Closed)
            {
                _jobAdsCommand.CloseJobAd(jobAd);
            }
            return(jobAd);
        }
Пример #20
0
        public void TestUpdateFeatures()
        {
            var employer = CreateEmployer();

            // None.

            var jobAd = new JobAd
            {
                PosterId    = employer.Id,
                Title       = string.Format(TitleFormat, 0),
                Description = { Content = string.Format(ContentFormat, 1) },
                Features    = JobAdFeatures.None
            };

            _jobAdsCommand.CreateJobAd(jobAd);

            AssertFeatures(JobAdFeatures.None, _jobAdsQuery.GetJobAd <JobAdEntry>(jobAd.Id));
            AssertFeatures(JobAdFeatures.None, _jobAdsQuery.GetJobAd <JobAd>(jobAd.Id));

            // Update.

            jobAd.Features = JobAdFeatures.Logo | JobAdFeatures.Highlight;
            _jobAdsCommand.UpdateJobAd(jobAd);

            AssertFeatures(JobAdFeatures.Logo | JobAdFeatures.Highlight, _jobAdsQuery.GetJobAd <JobAdEntry>(jobAd.Id));
            AssertFeatures(JobAdFeatures.Logo | JobAdFeatures.Highlight, _jobAdsQuery.GetJobAd <JobAd>(jobAd.Id));
        }
Пример #21
0
        public void TestFeaturedJobAds()
        {
            // Refresh whatever may be in the cache.

            var administrator = _administratorAccountsCommand.CreateTestAdministrator(0);

            _featuredCommand.UpdateFeaturedJobAds(new FeaturedItem[0]);
            ClearCache(administrator);

            // No job ads.

            Get(HomeUrl);
            Assert.IsNull(GetFeaturedJobAds());

            // Post a job ad yesterday.

            var employer = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0));
            var jobAd1   = CreateFeaturedJobAd(employer, 1);

            // Should not show up until cache is refreshed.

            Get(HomeUrl);
            Assert.IsNull(GetFeaturedJobAds());

            _featuredCommand.UpdateFeaturedJobAds(GetFeaturedJobAds(jobAd1));
            ClearCache(administrator);
            Get(HomeUrl);
            AssertFeaturedJobAds(jobAd1);

            // Post another job ad.

            var jobAd2 = CreateFeaturedJobAd(employer, 2);

            Get(HomeUrl);
            AssertFeaturedJobAds(jobAd1);

            _featuredCommand.UpdateFeaturedJobAds(GetFeaturedJobAds(jobAd1, jobAd2));
            ClearCache(administrator);
            Get(HomeUrl);
            AssertFeaturedJobAds(jobAd1, jobAd2);

            // Post 12 more.

            var jobAds = new JobAd[14];

            jobAds[0] = jobAd1;
            jobAds[1] = jobAd2;
            for (var index = 2; index < 14; ++index)
            {
                jobAds[index] = CreateFeaturedJobAd(employer, index + 1);
            }

            Get(HomeUrl);
            AssertFeaturedJobAds(jobAd1, jobAd2);

            _featuredCommand.UpdateFeaturedJobAds(GetFeaturedJobAds(jobAds));
            ClearCache(administrator);
            Get(HomeUrl);
            AssertFeaturedJobAds(jobAds);
        }
Пример #22
0
        private void TestCannotRemoveAllJobAdsFromOtherFolder(Func <IMember, JobAdFolder> getFolder, Func <HttpStatusCode, JobAdFolder, JsonListCountModel> removeAllJobAds)
        {
            const int count    = 3;
            var       jobAds   = new JobAd[count];
            var       employer = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestVerifiedOrganisation(0));

            for (var index = 0; index < count; ++index)
            {
                jobAds[index] = _jobAdsCommand.PostTestJobAd(employer);
            }

            // Create employer and folder.

            var member1 = _memberAccountsCommand.CreateTestMember(0);
            var member2 = _memberAccountsCommand.CreateTestMember(1);
            var folder  = getFolder(member2);

            _memberJobAdListsCommand.AddJobAdsToFolder(member2, folder, from j in jobAds select j.Id);

            // Log in and remove JobAds.

            LogIn(member1);
            var model = removeAllJobAds(HttpStatusCode.NotFound, folder);

            // Assert.

            AssertJsonError(model, null, "400", "The folder cannot be found.");
            AssertJobAds(member2, folder.Id, jobAds);
        }
Пример #23
0
        private PreviewJobAdModel GetPreviewJobAdModel(IUser employer, JobAd jobAd, JobAdFeaturePack featurePack)
        {
            var canBeOpened = _jobAdsCommand.CanBeOpened(jobAd);
            var expiryTime  = canBeOpened ? GetExpiryTime(jobAd.ExpiryTime, jobAd.Features) : GetExpiryTime(null, jobAd.Features);

            // For the purposes of previewing the job ad treat it as if it is open no matter what its real status is.

            var status = jobAd.Status;

            jobAd.Status = JobAdStatus.Open;

            // Preview the job ad as an anonymous member.

            var view = _memberJobAdViewsQuery.GetMemberJobAdView(null, jobAd);

            return(new PreviewJobAdModel
            {
                JobAd = view,
                JobAdCredits = GetJobAdCredits(employer),
                Status = status,
                ExpiryTime = expiryTime,
                CanBeOpened = canBeOpened,
                JobPoster = employer,
                FeaturePack = featurePack,
                Features = GetFeatures(),
                OrganisationCssFile = employer is IEmployer?HttpContext.GetOrganisationJobAdCssFile(((IEmployer)employer).Organisation.Id) : null,
            });
        }
Пример #24
0
        private void TestAddJobAdsToFolder(Func <IMember, JobAdFolder> getFolder, Func <JobAdFolder, JobAd[], JsonListCountModel> addJobAds)
        {
            const int count    = 3;
            var       jobAds   = new JobAd[count];
            var       employer = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestVerifiedOrganisation(0));

            for (var index = 0; index < count; ++index)
            {
                jobAds[index] = _jobAdsCommand.PostTestJobAd(employer);
            }

            // Create member and folder.

            var member = _memberAccountsCommand.CreateTestMember(0);
            var folder = getFolder(member);

            // Log in and add JobAds.

            LogIn(member);
            var model = addJobAds(folder, jobAds);

            // Assert.

            AssertModel(3, model);
            AssertJobAds(member, folder.Id, jobAds);

            // Add again.

            model = addJobAds(folder, jobAds);

            // Assert.

            AssertModel(3, model);
            AssertJobAds(member, folder.Id, jobAds);
        }
Пример #25
0
 private static void CheckInstances(JobAdFeedElement jaF, IEmployer employer, JobAd jobAd, string viewJobAdUrl, string applyJobAdUrl)
 {
     Assert.AreEqual(jaF.ViewJobAdUrl, viewJobAdUrl);
     Assert.AreEqual(jaF.ApplyJobAdUrl, applyJobAdUrl);
     Assert.AreEqual(jaF.Id, jobAd.Id);
     Assert.AreEqual(jaF.RecruiterCompanyName, employer.Organisation.Name);
     Assert.AreEqual(jaF.EmployerCompanyName, jobAd.Description.CompanyName);
     Assert.AreEqual(jaF.ContactDetails.FirstName, jobAd.ContactDetails.FirstName);
     Assert.AreEqual(jaF.ContactDetails.LastName, jobAd.ContactDetails.LastName);
     Assert.AreEqual(jaF.ContactDetails.EmailAddress, jobAd.ContactDetails.EmailAddress);
     Assert.AreEqual(jaF.ContactDetails.SecondaryEmailAddresses, jobAd.ContactDetails.SecondaryEmailAddresses);
     Assert.AreEqual(jaF.ContactDetails.PhoneNumber, jobAd.ContactDetails.PhoneNumber);
     Assert.AreEqual(jaF.ContactDetails.FaxNumber, jobAd.ContactDetails.FaxNumber);
     Assert.AreEqual(jaF.ExternalReferenceId, jobAd.Integration.ExternalReferenceId);
     Assert.AreEqual(jaF.ExternalApplyUrl, jobAd.Integration.ExternalApplyUrl);
     Assert.AreEqual(jaF.Title, jobAd.Title);
     Assert.AreEqual(jaF.PositionTitle, jobAd.Description.PositionTitle);
     Assert.AreEqual(jaF.Summary, jobAd.Description.Summary);
     Assert.AreEqual(jaF.Content, jobAd.Description.Content);
     Assert.AreEqual(jaF.JobTypes, jobAd.Description.JobTypes);
     Assert.AreEqual(jaF.Location, jobAd.Description.Location.ToString());
     Assert.AreEqual(jaF.Postcode, jobAd.Description.Location.Postcode);
     Assert.AreEqual(jaF.Salary, jobAd.Description.Salary);
     Assert.AreEqual(jaF.PackageDetails, jobAd.Description.Package);
     Assert.AreEqual(jaF.ResidencyRequired, jobAd.Description.ResidencyRequired);
     Assert.IsTrue(jaF.Industries.ToArray().NullableCollectionEqual((from i in jobAd.Description.Industries select i.Name).ToArray()));
     Assert.IsTrue(jaF.BulletPoints.NullableSequenceEqual(jobAd.Description.BulletPoints));
 }
Пример #26
0
        public void TestInitialize()
        {
            _australia = _locationQuery.GetCountry("Australia");

            Resolve <IDbConnectionFactory>().DeleteAllTestData();
            JobAdSearchHost.ClearIndex();

            var employer = _employerAccountsCommand.CreateTestEmployer("jobposter", _organisationsCommand.CreateTestOrganisation("The Job Advertiser"));

            _one                    = employer.CreateTestJobAd("Title one", "The content for the first ad");
            _one.CreatedTime        = DateTime.Now.AddDays(-1); // Just to make sure it's before "two"; we only index days.
            _one.Description.Salary = new Salary {
                LowerBound = 50000, UpperBound = 60000, Rate = SalaryRate.Year, Currency = Currency.AUD
            };
            _jobAdsCommand.CreateJobAd(_one);
            _jobAdsCommand.OpenJobAd(_one);

            _two = employer.CreateTestJobAd("Title two", "Different content for the second ad");
            _locationQuery.ResolvePostalSuburb(_two.Description.Location, _australia, "2000");
            _two.Description.CompanyName = "Really Bad Employers";
            _two.Description.JobTypes    = JobTypes.Contract;
            _two.Description.Industries  = new List <Industry> {
                _industriesQuery.GetIndustry("Other")
            };
            _jobAdsCommand.CreateJobAd(_two);
            _jobAdsCommand.OpenJobAd(_two);
        }
Пример #27
0
        private void AssertApplication(JobAd jobAd, Application application)
        {
            var applicationNodes = GetApplicationNodes();

            Assert.AreEqual(1, applicationNodes.Count);
            AssertApplication(applicationNodes[0], jobAd, application);
        }
Пример #28
0
        MemberSearchCriteria ISuggestedMembersQuery.GetCriteria(JobAd jobAd)
        {
            var criteria = new MemberSearchCriteria
            {
                Salary       = jobAd.Description.Salary,
                SortCriteria = new MemberSearchSortCriteria {
                    SortOrder = MemberSortOrder.Relevance
                },
            };

            var jobTitle = jobAd.Description.PositionTitle;

            if (TextUtil.TrimAndCheckEmpty(ref jobTitle))
            {
                jobTitle = jobAd.Title;
            }

            string newJobTitle;
            string jobTitleKeywords;

            GetJobTitleAndKeywords(jobTitle, out newJobTitle, out jobTitleKeywords);
            criteria.JobTitle        = newJobTitle;
            criteria.IncludeSynonyms = true;

            criteria.SetKeywords(CombineKeywords(jobTitleKeywords, GetIndustryKeywords(jobAd.Description.Industries)));

            if (jobAd.Description.Location != null)
            {
                // set location; default distance will be set in Query
                criteria.Location = jobAd.Description.Location;
            }

            return(criteria);
        }
Пример #29
0
        private static SuggestedJobsEmailItem CreateEmailItem(JobAd jobAd, JobSearchHighlighter highlighter)
        {
            var emailItem = new SuggestedJobsEmailItem
            {
                JobAdId  = jobAd.Id.ToString("n"),
                Title    = highlighter.HighlightTitle(jobAd.Title),
                Location = jobAd.GetLocationDisplayText()
            };

            if (jobAd.Description.Salary != null)
            {
                emailItem.Salary = jobAd.Description.Salary.GetDisplayText();
            }

            emailItem.PostedAge  = GetAgeString(DateTime.Now - jobAd.CreatedTime);
            emailItem.PostedDate = jobAd.CreatedTime.ToShortDateString();

            emailItem.JobType = jobAd.Description.JobTypes.GetDisplayText(", ", false, false);

            if (jobAd.Description.Industries != null)
            {
                emailItem.Industry = jobAd.Description.Industries.GetCriteriaIndustriesDisplayText();
            }

            Summarize(jobAd, highlighter, out emailItem.Digest, out emailItem.Fragments);

            return(emailItem);
        }
Пример #30
0
        protected void TestEdit(Action edit, Action <JobAd> assertJobAd)
        {
            var employer = CreateEmployer(null);

            LogIn(employer);

            var jobAd = new JobAd
            {
                Title       = DefaultTitle,
                Description =
                {
                    Content    = DefaultContent,
                    Industries = new[] { _accounting },
                    JobTypes   = JobTypes.FullTime,
                    Location   = _locationQuery.ResolveLocation(_locationQuery.GetCountry(DefaultCountry), DefaultLocation),
                },
                ContactDetails = new ContactDetails
                {
                    EmailAddress = employer.EmailAddress.Address,
                },
            };

            _employerJobAdsCommand.CreateJobAd(employer, jobAd);

            // Change.

            Get(GetJobAdUrl(jobAd.Id));
            edit();
            _saveButton.Click();
            AssertUrlWithoutQuery(GetJobAdUrl(jobAd.Id));
            AssertConfirmationMessage("The job ad has been saved.");

            jobAd = _jobAdsCommand.GetJobAd <JobAd>(jobAd.Id);
            assertJobAd(jobAd);
        }