Ejemplo n.º 1
0
        private static void AssertModel(JsonJobAdsModel model, params JobAd[] expectedJobAds)
        {
            AssertJsonSuccess(model);

            // Ensure that if there are both open and closed ads the open appear before the closed.

            JobAdApplicantsModel lastOpenJobAd    = null;
            JobAdApplicantsModel firstClosedJobAd = null;

            try
            {
                lastOpenJobAd    = model.JobAds.Last(jobAd => jobAd.Status == JobAdStatus.Open.ToString());
                firstClosedJobAd = model.JobAds.First(jobAd => jobAd.Status == JobAdStatus.Closed.ToString());
            }
            catch
            {
                //suppress errors from executing .last and .first on empty sequences
            }

            if (lastOpenJobAd != null && firstClosedJobAd != null)
            {
                Assert.IsTrue(model.JobAds.IndexOf(lastOpenJobAd) < model.JobAds.IndexOf(firstClosedJobAd));
            }

            Assert.AreEqual(expectedJobAds.Length, model.JobAds.Count);
            foreach (var expectedJobAd in expectedJobAds)
            {
                var expectedJobAdId = expectedJobAd.Id;
                var jobAdModel      = (from j in model.JobAds where j.Id == expectedJobAdId select j).Single();
                AssertModel(jobAdModel, expectedJobAd);
            }
        }
Ejemplo n.º 2
0
 private static void AssertModel(JobAdApplicantsModel model, JobAdEntry jobAd)
 {
     Assert.AreEqual(string.IsNullOrEmpty(jobAd.Integration.ExternalReferenceId) ? jobAd.Title : jobAd.Integration.ExternalReferenceId + ": " + jobAd.Title, model.Title);
     Assert.AreEqual(jobAd.Status.ToString(), model.Status);
 }