示例#1
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);
        }
        private void PostJobAd(IEmployer employer, int jobIndex, LocationReference location)
        {
            var industry = _industriesQuery.GetIndustries()[0];
            var jobAd    = employer.CreateTestJobAd(GetJobTitle(jobIndex, location), "The content for job #" + jobIndex + " in " + location, industry, location);

            _jobAdsCommand.PostJobAd(jobAd);
        }
示例#3
0
        protected virtual JobAd CreateJobAd(IEmployer employer)
        {
            var jobAd = employer.CreateTestJobAd();

            _jobAdsCommand.PostJobAd(jobAd);
            return(jobAd);
        }
示例#4
0
        protected JobAd PostJobAd(string jobTitle, int index, IEmployer employer)
        {
            var jobAd = employer.CreateTestJobAd(GetJobTitle(jobTitle, index), "The content for job #" + index);

            _jobAdsCommand.PostJobAd(jobAd);
            return(jobAd);
        }
示例#5
0
        public void TestJobSearchAlertEmailLinks()
        {
            var category = _settingsQuery.GetCategory("MemberAlert");

            // Create a job ad.

            var employer = _employerAccountsCommand.CreateTestEmployer(EmployerUserId, _organisationsCommand.CreateTestOrganisation(0));
            var jobAd    = employer.CreateTestJobAd(JobTitle, JobContent);

            _jobAdsCommand.PostJobAd(jobAd);

            // Do a search.

            var member         = _memberAccountsCommand.CreateTestMember(EmailAddress);
            var savedJobSearch = CreateTestSavedJobSearchAlert(member.Id, JobTitle, DateTime.Now.AddDays(-1));

            savedJobSearch = _jobAdSearchesQuery.GetJobAdSearch(savedJobSearch.Id);
            var search = PerformJobSearchUntilYouGetResults(member, savedJobSearch.Criteria, 1);

            Assert.AreEqual(1, search.Results.TotalMatches);

            // Send the email.

            AssertSettings(member, category, Frequency.Daily);

            _emailsCommand.TrySend(new JobSearchAlertEmail(member, search.Results.TotalMatches,
                                                           CreateEmailResults(search.Results, search.Criteria, MaximumResults),
                                                           search.Criteria, savedJobSearch.Id));

            var email = _emailServer.AssertEmailSent();

            AssertUnsubscribeLink(member, category, email.GetHtmlView().GetLinks()[5]);
        }
示例#6
0
        protected JobAd PostJobAd(IEmployer employer, string jobTitle)
        {
            var jobAd = employer.CreateTestJobAd(jobTitle);

            _jobAdsCommand.PostJobAd(jobAd);
            return(jobAd);
        }
示例#7
0
 private JobAd PostJobAd(IEmployer employer)
 {
     var jobAd = employer.CreateTestJobAd();
     jobAd.Description.Summary = "Summary";
     jobAd.Description.Industries = new List<Industry> { _industriesQuery.GetIndustries()[0] };
     _jobAdsCommand.PostJobAd(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
 private void PostJobAds(IEmployer employer)
 {
     foreach (var industry in Resolve <IIndustriesQuery>().GetIndustries())
     {
         var jobAd = employer.CreateTestJobAd("Manager", "Blah blah blah", industry);
         _jobAdsCommand.PostJobAd(jobAd);
     }
 }
示例#10
0
        private JobAd PostJobAd(Industry industry, NamedLocation location)
        {
            var employer = _employerAccountsCommand.CreateTestEmployer(UserId, _organisationsCommand.CreateTestOrganisation(0));
            var jobAd    = employer.CreateTestJobAd("Manager", "Blah blah blah", industry, new LocationReference(location));

            _jobAdsCommand.PostJobAd(jobAd);
            return(jobAd);
        }
示例#11
0
        protected JobAd CreateJobAd(IEmployer employer, string jobTitle, LocationReference location, Industry industry, Guid?integratorUserId)
        {
            var jobAd = employer.CreateTestJobAd(jobTitle, "Blah blah blah", industry, location);

            jobAd.Integration.IntegratorUserId = integratorUserId;
            _jobAdsCommand.PostJobAd(jobAd);
            return(jobAd);
        }
        private JobAd PostJobAd(IEmployer jobPoster, IntegratorUser integratorUser)
        {
            var jobAd = jobPoster.CreateTestJobAd();

            jobAd.Integration.IntegratorUserId = integratorUser.Id;
            jobAd.Integration.ExternalApplyUrl = "http://test.external/ad";
            _jobAdsCommand.PostJobAd(jobAd);
            return(jobAd);
        }
        private JobAd PostJobAd(IEmployer employer, string title)
        {
            var jobAd = employer.CreateTestJobAd(title);

            jobAd.CreatedTime        = DateTime.Now.AddDays(-1);
            jobAd.Description.Salary = null;
            _jobAdsCommand.PostJobAd(jobAd);
            return(jobAd);
        }
示例#14
0
        private JobAd PostJobAd(string jobTitle, int index, IEmployer employer, params Industry[] industries)
        {
            var jobAd = employer.CreateTestJobAd(GetJobTitle(jobTitle, index), "The content for job #" + index);

            jobAd.Description.Industries = industries;
            jobAd.Description.Location   = _locationQuery.ResolveLocation(_locationQuery.GetCountry("Australia"), "Melbourne VIC 3000");
            _jobAdsCommand.PostJobAd(jobAd);
            return(jobAd);
        }
示例#15
0
        protected JobAd PostJobAd(IEmployer employer)
        {
            var jobAd = employer.CreateTestJobAd();

            jobAd.Description.Summary     = "Summary";
            jobAd.Description.CompanyName = "An Advertiser";
            jobAd.Description.Industries  = new List <Industry> {
                _industriesQuery.GetIndustries()[0]
            };
            _jobAdsCommand.PostJobAd(jobAd);
            return(jobAd);
        }
        public void TestExecute()
        {
            MemberSearchHost.ClearIndex();

            // First candidate to find.

            IList <Member> members = new List <Member>();
            Member         member  = _memberAccountsCommand.CreateTestMember(0);

            AddSalaryAndResume(member.Id);
            members.Add(member);

            // Create employer.

            var employer  = _employerAccountsCommand.CreateTestEmployer(EmployerLoginId, _organisationsCommand.CreateTestOrganisation(0));
            var jobPoster = new JobPoster {
                Id = employer.Id, SendSuggestedCandidates = true
            };

            _jobPostersCommand.UpdateJobPoster(jobPoster);

            _allocationsCommand.CreateAllocation(new Allocation {
                OwnerId = employer.Id, CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, InitialQuantity = 1000
            });

            // Create a job that matches with the job poster as the contact.

            var jobAd = employer.CreateTestJobAd("Monkey boy");

            jobAd.CreatedTime        = DateTime.Now.AddDays(-1);
            jobAd.Description.Salary = null;
            _jobAdsCommand.PostJobAd(jobAd);

            // Execute.

            Execute(false);

            // Should get an email but for some reason that I can't quite figure out at the moment none is generated.
            // Will have to come back to it.

            //MockEmail email = SmtpServer.AssertEmailSent();
        }
示例#17
0
        protected Member PreLoadTestUserProfiles(bool admin, bool createEmployer, bool link,
                                                 bool inviters, bool fullSetOfNetworkers, bool jobs, bool references, bool resumeRequests)
        {
            #region set up 10 networkers

            Member five = null;
            Member six  = null;

            Member member    = _memberAccountsCommand.CreateTestMember(TestNetworkerUserId, "password", "Homer", "Simpson");
            var    candidate = _candidatesCommand.GetCandidate(member.Id);
            _candidateResumesCommand.AddTestResume(candidate);

            Member two   = _memberAccountsCommand.CreateTestMember(TestUserTwoId, "password", "Two First", "Two Last");
            Member three = _memberAccountsCommand.CreateTestMember(TestUserThreeId, "password", "Three First", "Three Last");

            Member four = _memberAccountsCommand.CreateTestMember(TestUserFourId);

            if (fullSetOfNetworkers)
            {
                five = _memberAccountsCommand.CreateTestMember(TestUserFiveId);
                six  = _memberAccountsCommand.CreateTestMember(TestUserSixId);
                _memberAccountsCommand.CreateTestMember(TestUserSevenId);
                _memberAccountsCommand.CreateTestMember(TestUserEightId);
                _memberAccountsCommand.CreateTestMember(TestUserNineId);
            }

            #endregion
            #region set up an employer and a job ad
            if (createEmployer)
            {
                Employer employer = _employerAccountsCommand.CreateTestEmployer(TestEmployerUserId, _organisationsCommand.CreateTestOrganisation("LinkMe Pty Ltd"));

                _allocationsCommand.CreateAllocation(new Allocation {
                    OwnerId = employer.Id, CreditId = _creditsQuery.GetCredit <ContactCredit>().Id, InitialQuantity = 1000
                });
                _allocationsCommand.CreateAllocation(new Allocation {
                    OwnerId = employer.Id, CreditId = _creditsQuery.GetCredit <JobAdCredit>().Id, InitialQuantity = 1000
                });

                var ja = employer.CreateTestJobAd("test job", "lol test job");
                _jobAdsCommand.PostJobAd(ja);
            }
            #endregion
            #region set up an administrator

            if (admin)
            {
                CreateAdministrator(TestAdministratorUserId);
            }

            #endregion
            #region link up some users

            if (link)
            {
                _networkingCommand.CreateFirstDegreeLink(member.Id, two.Id);
                _networkingCommand.CreateFirstDegreeLink(member.Id, three.Id);
                _networkingCommand.CreateFirstDegreeLink(member.Id, four.Id);
            }

            if (link && fullSetOfNetworkers)
            {
                _networkingCommand.CreateFirstDegreeLink(two.Id, five.Id);
                _networkingCommand.CreateFirstDegreeLink(two.Id, six.Id);
                _networkingCommand.CreateFirstDegreeLink(three.Id, six.Id);
            }

            #endregion
            return(member);
        }
示例#18
0
        public void TestAddJobAdForCustomCss()
        {
            var cssDir = FileSystem.GetAbsolutePath(@"Apps\Web\ui\styles\Recruiters",
                                                    RuntimeEnvironment.GetSourceFolder());

            if (!Directory.Exists(cssDir))
            {
                throw new DirectoryNotFoundException("The company CSS directory, '" + cssDir + "', does not exist.");
            }

            var cssFiles = Directory.GetFiles(cssDir, "*.css", SearchOption.TopDirectoryOnly);
            var i        = 0;

            Guid?[] integratorUserId = { null, _careerOneQuery.GetIntegratorUser().Id, _integrationCommand.CreateTestIntegratorUser().Id };
            foreach (var cssFile in cssFiles)
            {
                try
                {
                    var fileName = Path.GetFileName(cssFile);
                    var parts    = fileName.Split(new[] { " - " }, StringSplitOptions.RemoveEmptyEntries);
                    if (parts.Length == 2)
                    {
                        var orgName = parts[0];
                        orgName = orgName.Replace('(', ' ');
                        orgName = orgName.Replace(')', ' ');
                        try
                        {
                            var orgId    = new Guid(parts[1].Substring(0, parts[1].LastIndexOf(".css")));
                            var pCode    = (int)(new Random(i).NextDouble() * 100);
                            var location = _locationQuery.ResolveLocation(_locationQuery.GetCountry("Australia"),
                                                                          "20" + (pCode < 10 ? "0" : "") + pCode);
                            var org = new Organisation
                            {
                                Id = orgId, Name = orgName, Address = new Address {
                                    Location = location
                                }
                            };
                            _organisationsCommand.CreateOrganisation(org);
                            var employer = _employerAccountsCommand.CreateTestEmployer(i, org);
                            var jobAd    = employer.CreateTestJobAd(orgName + " test job ads", "test suggest job content, test long text, test ellipsis. test suggest job content, test long text, test ellipsis. test suggest job content, test long text, test ellipsis. test suggest job content, test long text, test ellipsis.", _industriesQuery.GetIndustries()[(int)(new Random(i).NextDouble() * 28)], location);
                            var count    = (int)(new Random(i).NextDouble() * 5);
                            var jobTypes = new List <JobTypes>();
                            for (var j = 0; j < count; j++)
                            {
                                jobTypes.Add(new List <JobTypes> {
                                    JobTypes.FullTime, JobTypes.PartTime, JobTypes.Contract, JobTypes.Temp, JobTypes.JobShare
                                }[(int)(new Random(i + j).NextDouble() * 5)]);
                            }
                            var jobType = JobTypes.None;
                            foreach (var jt in jobTypes)
                            {
                                jobType |= jt;
                            }
                            Salary salary;
                            if (i % 2 == 0)
                            {
                                salary = new Salary
                                {
                                    LowerBound = (int)(new Random(i).NextDouble() * 25) * 5000,
                                    UpperBound = (int)((1 - new Random(i + 1).NextDouble()) * 50) * 5000,
                                    Rate       = SalaryRate.Year,
                                    Currency   = Currency.AUD
                                }
                            }
                            ;
                            else
                            {
                                salary = new Salary
                                {
                                    LowerBound = (int)(new Random(i).NextDouble() * 25) * 5,
                                    UpperBound = (int)((1 - new Random(i + 1).NextDouble()) * 50) * 5,
                                    Rate       = SalaryRate.Hour,
                                    Currency   = Currency.AUD
                                }
                            };
                            jobAd.Description.Salary           = salary;
                            jobAd.Description.JobTypes         = jobType;
                            jobAd.Integration.IntegratorUserId = integratorUserId[(int)(new Random(i).NextDouble() * 3)];
                            jobAd.Integration.ExternalApplyUrl = (jobAd.Integration.IntegratorUserId == null ? string.Empty : "http://jobview.careerone.com.au/GetJob.aspx?JobID=103216325&WT.mc_n=AFC_linkme");
                            jobAd.CreatedTime  = DateTime.Now.AddHours(0 - new Random(i).NextDouble() * 100);
                            jobAd.FeatureBoost = (i % 2 == 0) ? JobAdFeatureBoost.Low : JobAdFeatureBoost.None;
                            _jobAdsCommand.PostJobAd(jobAd);
                        }
                        catch (FormatException)
                        {
                        }
                    }
                    i++;
                }
                catch (Exception ex)
                {
                    throw new ApplicationException("Failed to process CSS file '" + cssFile + "'.", ex);
                }
            }
            //add a default jobad (without custom stylesheet)
            var anotherOrg = new Organisation
            {
                Id      = new Guid(),
                Name    = "LinkMe",
                Address = new Address
                {
                    Location = _locationQuery.ResolveLocation(_locationQuery.GetCountry("Australia"),
                                                              "Neutral Bay NSW 2089")
                }
            };

            _organisationsCommand.CreateOrganisation(anotherOrg);
            var anotherEmployer = _employerAccountsCommand.CreateTestEmployer(i, anotherOrg);
            var anotherJobAd    = anotherEmployer.CreateTestJobAd("LinkMe test job ads",
                                                                  "test suggest job content, test long text, test ellipsis. test suggest job content, test long text, test ellipsis. test suggest job content, test long text, test ellipsis. test suggest job content, test long text, test ellipsis.",
                                                                  _industriesQuery.GetIndustries()[(int)(new Random(i).NextDouble() * 28)], _locationQuery.ResolveLocation(_locationQuery.GetCountry("Australia"),
                                                                                                                                                                           "Neutral Bay NSW 2089"));

            anotherJobAd.Integration.IntegratorUserId = integratorUserId[1]; //Career One
            anotherJobAd.Integration.ExternalApplyUrl = "http://jobview.careerone.com.au/GetJob.aspx?JobID=103216325&WT.mc_n=AFC_linkme";
            _jobAdsCommand.PostJobAd(anotherJobAd);
            anotherJobAd = anotherEmployer.CreateTestJobAd("LinkMe test job ads - non CareerOne",
                                                           "test suggest job content, test long text, test ellipsis. test suggest job content, test long text, test ellipsis. test suggest job content, test long text, test ellipsis. test suggest job content, test long text, test ellipsis.",
                                                           _industriesQuery.GetIndustries()[(int)(new Random(i).NextDouble() * 28)], _locationQuery.ResolveLocation(_locationQuery.GetCountry("Australia"),
                                                                                                                                                                    "Neutral Bay NSW 2089"));
            _jobAdsCommand.PostJobAd(anotherJobAd);
        }
示例#19
0
        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);
        }
示例#20
0
        private void PostJobAd(IEmployer employer, int jobIndex, Country country, LocationReference location)
        {
            var jobAd = employer.CreateTestJobAd(GetJobTitle(jobIndex, country, location), "The content for job #" + jobIndex + " in " + location, GetIndustry(), location);

            _jobAdsCommand.PostJobAd(jobAd);
        }