コード例 #1
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));
 }
コード例 #2
0
ファイル: GetJobAdsTest.cs プロジェクト: formist/LinkMe
        private void CompareJobAdFeed(JobAdFeedElement localJobAd, JobAdFeedElement netJobAd)
        {
            AssertEquals(netJobAd.Title, localJobAd.Title);
            AssertEquals(netJobAd.PositionTitle, localJobAd.PositionTitle);
            AssertEquals(netJobAd.BulletPoints.Length, localJobAd.BulletPoints.Length);

            int i = 0;

            foreach (string bp in netJobAd.BulletPoints)
            {
                AssertEquals(bp, localJobAd.BulletPoints[i++]);
            }
            AssertEquals(netJobAd.Summary, localJobAd.Summary);
            AssertEquals(netJobAd.Content, localJobAd.Content);
            AssertEquals(netJobAd.EmployerCompanyName, localJobAd.EmployerCompanyName);
            AssertEquals(netJobAd.JobTypes, localJobAd.JobTypes);
            AssertEquals(netJobAd.Location, localJobAd.Location);
            AssertEquals(netJobAd.Postcode, localJobAd.Postcode);
            AssertEquals(netJobAd.Salary.HasLowerBound, localJobAd.Salary.HasLowerBound);
            AssertEquals(netJobAd.Salary.HasUpperBound, localJobAd.Salary.HasUpperBound);
            AssertEquals(netJobAd.Salary.IsEmpty, localJobAd.Salary.IsEmpty);
            AssertEquals(netJobAd.Salary.LowerBound, localJobAd.Salary.LowerBound);
            AssertEquals(netJobAd.Salary.UpperBound, localJobAd.Salary.UpperBound);
            AssertEquals(netJobAd.PackageDetails, localJobAd.PackageDetails);
            AssertEquals(netJobAd.ResidencyRequired, localJobAd.ResidencyRequired);
            AssertEquals(netJobAd.ContactDetails.FirstName, localJobAd.ContactDetails.FirstName);
            AssertEquals(netJobAd.ContactDetails.LastName, localJobAd.ContactDetails.LastName);
            AssertEquals(netJobAd.ContactDetails.EmailAddress, localJobAd.ContactDetails.EmailAddress);
            AssertEquals(netJobAd.ContactDetails.FaxNumber, localJobAd.ContactDetails.FaxNumber);
            AssertEquals(netJobAd.ContactDetails.PhoneNumber, localJobAd.ContactDetails.PhoneNumber);
            AssertEquals(netJobAd.Industries.Count, localJobAd.Industries.Count);
            i = 0;
            foreach (var industry in netJobAd.Industries)
            {
                AssertEquals(localJobAd.Industries[i++], industry);
            }
            AssertEquals(netJobAd.ViewJobAdUrl, localJobAd.ViewJobAdUrl);
            AssertEquals(netJobAd.ViewJobAdUrl, String.Format("{0}jobs/job.aspx?jobadid={1}",
                                                              new ApplicationUrl("~/").AbsoluteUri, netJobAd.Id));

            AssertEquals(netJobAd.ApplyJobAdUrl, localJobAd.ApplyJobAdUrl);
            AssertEquals(netJobAd.ApplyJobAdUrl, String.Format("{0}ui/unregistered/common/jobapplicationsigninform.aspx?jobadid={1}",
                                                               new ApplicationUrl("~/").AbsoluteUri, netJobAd.Id));

            // Not set in the original post.

            AssertEquals(null, netJobAd.RecruiterCompanyName);
        }
コード例 #3
0
        protected static JobAdFeedElement GetJobAdFeed(string response)
        {
            JobAdFeedElement jobAdFeed = null;

            var xmlSerializer = new XmlSerializer(typeof(JobAdFeedElement), null, new Type[] { }, null, Apps.Services.Constants.XmlSerializationNamespace);
            var reader        = XmlReader.Create(new StringReader(response));

            reader.MoveToContent();
            Assert.AreEqual("GetJobAdsResponse", reader.LocalName);
            reader.ReadStartElement();
            if (reader.IsStartElement())
            {
                Assert.AreEqual("JobAd", reader.LocalName);
                jobAdFeed = (JobAdFeedElement)xmlSerializer.Deserialize(reader);
            }
            reader.Close();

            return(jobAdFeed);
        }
コード例 #4
0
        protected void AssertJobAdFeed(IEmployer poster, JobAd expectedJobAd, JobAdFeedElement jobAdFeed)
        {
            Assert.AreEqual(jobAdFeed.Title, expectedJobAd.Title);
            Assert.AreEqual(jobAdFeed.PositionTitle, expectedJobAd.Description.PositionTitle);
            Assert.AreEqual(jobAdFeed.BulletPoints.Length, expectedJobAd.Description.BulletPoints.Count);

            for (var index = 0; index < jobAdFeed.BulletPoints.Length; ++index)
            {
                Assert.AreEqual(jobAdFeed.BulletPoints[index], expectedJobAd.Description.BulletPoints[index]);
            }

            Assert.AreEqual(jobAdFeed.Summary, expectedJobAd.Description.Summary);
            Assert.AreEqual(jobAdFeed.Content, expectedJobAd.Description.Content);
            Assert.AreEqual(jobAdFeed.EmployerCompanyName, expectedJobAd.Description.CompanyName);
            Assert.AreEqual(jobAdFeed.JobTypes, expectedJobAd.Description.JobTypes);
            Assert.AreEqual(jobAdFeed.Location, expectedJobAd.Description.Location != null ? expectedJobAd.Description.Location.ToString() : null);
            Assert.AreEqual(jobAdFeed.Postcode, expectedJobAd.Description.Location != null ? expectedJobAd.Description.Location.Postcode : null);
            Assert.AreEqual(jobAdFeed.Salary.HasLowerBound, expectedJobAd.Description.Salary.HasLowerBound);
            Assert.AreEqual(jobAdFeed.Salary.HasUpperBound, expectedJobAd.Description.Salary.HasUpperBound);
            Assert.AreEqual(jobAdFeed.Salary.IsEmpty, expectedJobAd.Description.Salary.IsEmpty);
            Assert.AreEqual(jobAdFeed.Salary.LowerBound, expectedJobAd.Description.Salary.LowerBound);
            Assert.AreEqual(jobAdFeed.Salary.UpperBound, expectedJobAd.Description.Salary.UpperBound);
            Assert.AreEqual(jobAdFeed.PackageDetails, expectedJobAd.Description.Package);
            Assert.AreEqual(jobAdFeed.ResidencyRequired, expectedJobAd.Description.ResidencyRequired);
            if (expectedJobAd.ContactDetails == null)
            {
                Assert.IsNull(jobAdFeed.ContactDetails);
                Assert.AreEqual(jobAdFeed.RecruiterCompanyName, null);
            }
            else
            {
                Assert.AreEqual(jobAdFeed.ContactDetails.FirstName, expectedJobAd.ContactDetails.FirstName);
                Assert.AreEqual(jobAdFeed.ContactDetails.LastName, expectedJobAd.ContactDetails.LastName);
                Assert.AreEqual(jobAdFeed.ContactDetails.EmailAddress, expectedJobAd.ContactDetails.EmailAddress);
                Assert.AreEqual(jobAdFeed.ContactDetails.FaxNumber, expectedJobAd.ContactDetails.FaxNumber);
                Assert.AreEqual(jobAdFeed.ContactDetails.PhoneNumber, expectedJobAd.ContactDetails.PhoneNumber);

                if (poster == null)
                {
                    Assert.IsNull(jobAdFeed.RecruiterCompanyName);
                }
                else
                {
                    Assert.AreEqual(jobAdFeed.RecruiterCompanyName, poster.Organisation.Name);
                }
            }

            if (expectedJobAd.Description.Industries == null)
            {
                Assert.AreEqual(jobAdFeed.Industries.Count, 0);
            }
            else
            {
                Assert.AreEqual(jobAdFeed.Industries.Count, expectedJobAd.Description.Industries.Count);
                for (var index = 0; index < jobAdFeed.Industries.Count; ++index)
                {
                    Assert.AreEqual(jobAdFeed.Industries[index], expectedJobAd.Description.Industries[index].Name);
                }
            }

            // They are now the same url.

            var viewJobAdUrl  = GetJobUrl(expectedJobAd);
            var applyJobAdUrl = GetJobUrl(expectedJobAd);

            Assert.AreEqual(jobAdFeed.ViewJobAdUrl.ToLower(), viewJobAdUrl.AbsoluteUri.ToLower());
            Assert.AreEqual(jobAdFeed.ApplyJobAdUrl.ToLower(), applyJobAdUrl.AbsoluteUri.ToLower());
        }
コード例 #5
0
ファイル: HideJobAdTests.cs プロジェクト: formist/LinkMe
        protected void AssertHide(string expectedCompanyName, ContactDetails expectedContactDetails, JobAdFeedElement jobAdFeed)
        {
            Assert.AreEqual(expectedCompanyName, jobAdFeed.EmployerCompanyName);

            if (expectedContactDetails == null)
            {
                Assert.IsNull(jobAdFeed.ContactDetails);
                Assert.AreEqual(null, jobAdFeed.RecruiterCompanyName);
            }
            else
            {
                Assert.AreEqual(expectedContactDetails.FirstName, jobAdFeed.ContactDetails.FirstName);
                Assert.AreEqual(expectedContactDetails.LastName, jobAdFeed.ContactDetails.LastName);
                Assert.AreEqual(expectedContactDetails.EmailAddress, jobAdFeed.ContactDetails.EmailAddress);
                Assert.AreEqual(expectedContactDetails.FaxNumber, jobAdFeed.ContactDetails.FaxNumber);
                Assert.AreEqual(expectedContactDetails.PhoneNumber, jobAdFeed.ContactDetails.PhoneNumber);
                Assert.AreEqual(expectedContactDetails.CompanyName, jobAdFeed.RecruiterCompanyName);
            }
        }