Ejemplo n.º 1
0
        protected JobAd AssertJobAd(Guid posterId, JobAdStatus expectedStatus, JobAdFeatures features)
        {
            var jobAds = _jobAdsQuery.GetJobAds <JobAd>(_jobAdsQuery.GetJobAdIds(posterId));

            Assert.AreEqual(1, jobAds.Count);

            var jobAd = jobAds[0];

            Assert.AreEqual(DefaultTitle, jobAd.Title);
            Assert.AreEqual(DefaultContent, jobAd.Description.Content);
            Assert.IsTrue(new[] { _accounting.Id }.CollectionEqual(jobAd.Description.Industries.Select(i => i.Id)));
            Assert.AreEqual(JobTypes.FullTime, jobAd.Description.JobTypes);
            Assert.AreEqual(expectedStatus, jobAd.Status);

            // Check features.

            Assert.AreEqual(features, jobAd.Features);
            var expectedExpiryTime = expectedStatus != JobAdStatus.Open
                ? (DateTime?)null
                : features.IsFlagSet(JobAdFeatures.ExtendedExpiry)
                    ? DateTime.Now.Date.AddDays(30).AddDays(1).AddSeconds(-1)
                    : DateTime.Now.Date.AddDays(14).AddDays(1).AddSeconds(-1);

            Assert.AreEqual(expectedExpiryTime, jobAd.ExpiryTime);

            return(jobAd);
        }
Ejemplo n.º 2
0
        private void CreateNewJobAd(string adContent, JobAdStatus adStatus, IHasId <Guid> adPoster,
                                    bool adHideContactDetails, ContactDetails adContactDetails, string summary, string bulletpoint1, string bulletpoint2,
                                    string bulletpoint3, FileReference logoImg, string adTitle, string positionTitle,
                                    JobTypes jobtypes, bool isResidenacyRequired, string externalRef, decimal?maxsalary,
                                    decimal?minsalary, string package, IList <Industry> reqIndustries, string companyname,
                                    LocationReference jobLocation, DateTime expiryDate)
        {
            var bulletPoints = new[] { bulletpoint1, bulletpoint2, bulletpoint3 };

            var newJobAd = new JobAd
            {
                Status     = adStatus,
                PosterId   = adPoster.Id,
                Visibility =
                {
                    HideContactDetails = adHideContactDetails,
                    HideCompany        = false,
                },
                ContactDetails = adContactDetails,
                Title          = adTitle,
                Integration    = { ExternalReferenceId = externalRef },
                LogoId         = logoImg == null ? (Guid?)null : logoImg.Id,
                ExpiryTime     = expiryDate,
                Description    =
                {
                    CompanyName       = companyname,
                    Content           = adContent,
                    PositionTitle     = positionTitle,
                    ResidencyRequired = isResidenacyRequired,
                    JobTypes          = jobtypes,
                    Industries        = reqIndustries,
                    Summary           = summary,
                    Salary            = (minsalary.HasValue || maxsalary.HasValue
                        ? new Salary
                    {
                        Currency      = Currency.AUD,
                        LowerBound    = minsalary,
                        UpperBound    = maxsalary,
                        Rate          = SalaryRate.Year,
                    }
                        : null),
                    Package      = package,
                    BulletPoints = bulletPoints,
                    Location     = jobLocation,
                }
            };

            _jobAdsCommand.CreateJobAd(newJobAd);

            if (adStatus == JobAdStatus.Open)
            {
                _jobAdsCommand.OpenJobAd(newJobAd);
            }
            else if (adStatus == JobAdStatus.Closed)
            {
                _jobAdsCommand.CloseJobAd(newJobAd);
            }

            return;
        }
Ejemplo n.º 3
0
 public ManageCandidatesNavigation(Guid jobAdId, JobAdStatus jobAdStatus, ApplicantStatus applicantStatus, CandidatesPresentationModel presentation)
     : base(presentation)
 {
     JobAdId         = jobAdId;
     JobAdStatus     = jobAdStatus;
     ApplicantStatus = applicantStatus;
 }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
 public SuggestedCandidatesNavigation(Guid jobAdId, string jobAdTitle, JobAdStatus jobAdStatus, MemberSearchCriteria criteria, CandidatesPresentationModel presentation)
     : base(criteria, presentation)
 {
     JobAdId     = jobAdId;
     JobAdTitle  = jobAdTitle;
     JobAdStatus = jobAdStatus;
 }
Ejemplo n.º 6
0
        void IJobAdsRepository.ChangeStatus(Guid jobAdId, JobAdStatus newStatus, DateTime?newExpiryTime, DateTime time)
        {
            using (var dc = CreateContext())
            {
                // Update the status on the job ad itself.

                var entity         = GetJobAdEntity(dc, jobAdId);
                var previousStatus = entity.status;
                entity.status          = (byte)newStatus;
                entity.lastUpdatedTime = time;

                if (newExpiryTime != null)
                {
                    entity.expiryTime = newExpiryTime.Value;
                }

                // Record the change.

                var change = new JobAdStatusChange
                {
                    Id             = Guid.NewGuid(),
                    Time           = time,
                    PreviousStatus = (JobAdStatus)previousStatus,
                    NewStatus      = newStatus
                };
                dc.JobAdStatusEntities.InsertOnSubmit(change.Map(jobAdId));

                dc.SubmitChanges();
            }
        }
Ejemplo n.º 7
0
 IList <Guid> IJobAdsRepository.GetJobAdIds(Guid posterId, JobAdStatus status)
 {
     using (var dc = CreateContext().AsReadOnly())
     {
         return(GetJobAdIds(dc, posterId, status).ToList());
     }
 }
Ejemplo n.º 8
0
        protected void AssertJobAd(Guid jobAdId, JobAdStatus expectedStatus, DateTime?expectedExpiryTime)
        {
            var jobAd = _jobAdsQuery.GetJobAd <JobAdEntry>(jobAdId);

            Assert.IsNotNull(jobAd);
            Assert.AreEqual(expectedStatus, jobAd.Status);
            Assert.AreEqual(expectedExpiryTime, jobAd.ExpiryTime);
        }
Ejemplo n.º 9
0
 private void AssertStatus(JobAdStatus expectedStatus, DateTime?expectedExpiryTime, JobAd jobAd)
 {
     Assert.AreEqual(expectedStatus, jobAd.Status);
     Assert.AreEqual(expectedExpiryTime, jobAd.ExpiryTime);
     jobAd = _jobAdsQuery.GetJobAd <JobAd>(jobAd.Id);
     Assert.AreEqual(expectedStatus, jobAd.Status);
     Assert.AreEqual(expectedExpiryTime, jobAd.ExpiryTime);
 }
Ejemplo n.º 10
0
        private JobAd CreateNewJobAd(string adContent, JobAdStatus adStatus, IHasId <Guid> adPoster,
                                     bool adHideContactDetails, ContactDetails adContactDetails, string summary, string bulletpoint1, string bulletpoint2,
                                     string bulletpoint3, FileReference logoImg, string adTitle, string positionTitle,
                                     JobTypes jobtypes, bool isResidenacyRequired, string externalRef, string maxsalary,
                                     string minsalary, string package, IList <Industry> reqIndustries, string companyname,
                                     LocationReference jobLocation, DateTime expiryDate)
        {
            var salary       = SalaryExtensions.Parse(minsalary, maxsalary, SalaryRate.Year, true);
            var bulletPoints = new[] { bulletpoint1, bulletpoint2, bulletpoint3 };

            var newJobAd = new JobAd
            {
                Status     = adStatus,
                PosterId   = adPoster.Id,
                Visibility =
                {
                    HideContactDetails = adHideContactDetails,
                    HideCompany        = false,
                },
                ContactDetails = adContactDetails,
                Title          = adTitle,
                Integration    = { ExternalReferenceId = externalRef },
                LogoId         = logoImg == null ? (Guid?)null : logoImg.Id,
                ExpiryTime     = expiryDate,
                Description    =
                {
                    CompanyName       = companyname,
                    Content           = adContent,
                    PositionTitle     = positionTitle,
                    ResidencyRequired = isResidenacyRequired,
                    JobTypes          = jobtypes,
                    Industries        = reqIndustries,
                    Summary           = summary,
                    Salary            = salary,
                    Package           = package,
                    BulletPoints      = bulletPoints,
                    Location          = jobLocation,
                }
            };

            _jobAdsCommand.CreateJobAd(newJobAd);
            _jobAdsCommand.OpenJobAd(newJobAd);

            return(newJobAd);
        }
Ejemplo n.º 11
0
        protected JobAd CreateJobAd(IEmployer employer, JobAdStatus status)
        {
            var jobAd = employer.CreateTestJobAd();

            _employerJobAdsCommand.CreateJobAd(employer, jobAd);

            switch (status)
            {
            case JobAdStatus.Open:
                _employerJobAdsCommand.OpenJobAd(employer, jobAd, false);
                break;

            case JobAdStatus.Closed:
                _employerJobAdsCommand.OpenJobAd(employer, jobAd, false);
                _employerJobAdsCommand.CloseJobAd(employer, jobAd);
                break;
            }

            return(jobAd);
        }
Ejemplo n.º 12
0
        protected JobAd CreateJobAd(IEmployer employer, JobAdStatus status, DateTime createdTime, DateTime?expiryTime)
        {
            var jobAd = employer.CreateTestJobAd();

            _employerJobAdsCommand.CreateJobAd(employer, jobAd);

            switch (status)
            {
            case JobAdStatus.Open:
                _employerJobAdsCommand.OpenJobAd(employer, jobAd, false);
                break;

            case JobAdStatus.Closed:
                _employerJobAdsCommand.OpenJobAd(employer, jobAd, false);
                _employerJobAdsCommand.CloseJobAd(employer, jobAd);
                break;
            }

            jobAd.CreatedTime = createdTime;
            jobAd.ExpiryTime  = expiryTime;
            _jobAdsCommand.UpdateJobAd(jobAd);

            return(jobAd);
        }
Ejemplo n.º 13
0
 private void AssertJobAd(IntegratorUser integratorUser, JobAdStatus expectedStatus, JobAdElement expectedJobAd, IEnumerable <JobAd> jobAds)
 {
     AssertJobAd(expectedJobAd, AssertJobAd((from j in jobAds where j.Integration.ExternalReferenceId == expectedJobAd.ExternalReferenceId select j).Single(), integratorUser, expectedJobAd.ExternalReferenceId, expectedStatus));
 }
Ejemplo n.º 14
0
 IList <Guid> IJobAdsRepository.GetJobAdIds(Guid posterId, JobAdStatus status)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 15
0
        protected JobAd AssertJobAd(IntegratorUser integratorUser, Guid employerId, string externalReferenceId, JobAdStatus expectedStatus)
        {
            var jobAds = _jobAdsQuery.GetJobAds <JobAd>(_jobAdIntegrationQuery.GetJobAdIds(integratorUser.Id, employerId, externalReferenceId));

            Assert.AreEqual(1, jobAds.Count);
            return(AssertJobAd(jobAds[0], integratorUser, externalReferenceId, expectedStatus));
        }
Ejemplo n.º 16
0
        private SuggestedCandidatesListModel Search(IEmployer employer, Guid jobAdId, MemberSearchCriteria criteria, CandidatesPresentationModel presentation, string jobAdTitle, JobAdStatus jobAdStatus)
        {
            var searchList = GetSearchList(Search(employer, jobAdId, criteria, presentation));

            searchList.JobAd = new JobAdDataModel
            {
                Id     = jobAdId,
                Title  = jobAdTitle,
                Status = jobAdStatus,
            };

            return(searchList);
        }
Ejemplo n.º 17
0
 void IJobAdsRepository.ChangeStatus(Guid jobAdId, JobAdStatus status, DateTime?expiryTime, DateTime updatedTime)
 {
 }
Ejemplo n.º 18
0
 public static JobAd PostTestJobAd(this IJobAdsCommand jobAdsCommand, IEmployer employer, JobAdStatus jobStatus)
 {
     return(PostTestJobAd(jobAdsCommand, employer.CreateTestJobAd(), jobStatus));
 }
Ejemplo n.º 19
0
 protected JobAd AssertJobAd(JobAd jobAd, IntegratorUser integratorUser, string externalReferenceId, JobAdStatus expectedStatus)
 {
     Assert.IsNotNull(jobAd);
     Assert.AreEqual(integratorUser.Id, jobAd.Integration.IntegratorUserId);
     Assert.AreEqual(externalReferenceId, jobAd.Integration.ExternalReferenceId);
     Assert.AreEqual(expectedStatus, jobAd.Status);
     return(jobAd);
 }
Ejemplo n.º 20
0
 IList <Guid> IJobAdsQuery.GetJobAdIds(Guid posterId, JobAdStatus status)
 {
     return(_repository.GetJobAdIds(posterId, status));
 }
Ejemplo n.º 21
0
        private static JobAd PostTestJobAd(this IJobAdsCommand jobAdsCommand, JobAd jobAd, JobAdStatus jobStatus)
        {
            jobAdsCommand.CreateJobAd(jobAd);
            switch (jobStatus)
            {
            case JobAdStatus.Open:
                jobAdsCommand.OpenJobAd(jobAd);
                break;

            case JobAdStatus.Closed:
                jobAdsCommand.OpenJobAd(jobAd);
                jobAdsCommand.CloseJobAd(jobAd);
                break;

            case JobAdStatus.Deleted:
                jobAdsCommand.DeleteJobAd(jobAd);
                break;
            }

            return(jobAd);
        }
Ejemplo n.º 22
0
 public static JobAd PostTestJobAd(this IJobAdsCommand jobAdsCommand, AnonymousUser user, JobAdStatus jobStatus)
 {
     return(PostTestJobAd(jobAdsCommand, user.CreateTestJobAd(), jobStatus));
 }
Ejemplo n.º 23
0
 public JobAdOpenedEventArgs(Guid jobAdId, JobAdStatus previousStatus)
     : base(jobAdId)
 {
     PreviousStatus = previousStatus;
 }
Ejemplo n.º 24
0
        private static JobAd PostTestJobAd(this IJobAdsCommand jobAdsCommand, JobAd jobAd, JobAdStatus jobStatus)
        {
            jobAdsCommand.CreateJobAd(jobAd);
            switch (jobStatus)
            {
            case JobAdStatus.Open:
                jobAdsCommand.OpenJobAd(jobAd);
                break;

            case JobAdStatus.Closed:
                jobAdsCommand.OpenJobAd(jobAd);
                jobAdsCommand.CloseJobAd(jobAd);
                break;

            case JobAdStatus.Deleted:
                jobAdsCommand.DeleteJobAd(jobAd);
                break;

            default:
                //do nothing - job is created in draft state
                break;
            }

            return(jobAd);
        }