Exemple #1
0
        public void SubmittingVacancyApplicationTest()
        {
            //Arrange
            var vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Submitting).Build();
            var candidate          = new CandidateSummaryBuilder().WithCandidateId(vacancyApplication.CandidateId).Build();

            //Act
            var application = _applicationMappers.MapApplication(vacancyApplication, candidate.LegacyCandidateId, new Dictionary <Guid, int>(), new Dictionary <int, ApplicationSummary>(), new Dictionary <int, int>(), new Dictionary <int, SubVacancy>()).Application;

            //Assert
            application.ApplicationId.Should().Be(vacancyApplication.LegacyApplicationId);
            application.CandidateId.Should().Be(candidate.LegacyCandidateId);
            application.VacancyId.Should().Be(vacancyApplication.Vacancy.Id);
            application.ApplicationStatusTypeId.Should().Be(1);
            application.WithdrawnOrDeclinedReasonId.Should().Be(0);
            application.UnsuccessfulReasonId.Should().Be(0);
            application.OutcomeReasonOther.Should().Be(null);
            application.NextActionId.Should().Be(0);
            application.NextActionOther.Should().Be(null);
            application.AllocatedTo.Should().Be(null);
            application.CVAttachmentId.Should().Be(null);
            application.BeingSupportedBy.Should().Be(null);
            application.LockedForSupportUntil.Should().Be(null);
            application.WithdrawalAcknowledged.Should().Be(true);
            application.ApplicationGuid.Should().Be(vacancyApplication.Id);
        }
Exemple #2
0
        public void SchoolAttendedDictionaryTest()
        {
            //Arrange
            var applicationTemplate = new ApplicationTemplate
            {
                EducationHistory = new Education
                {
                    Institution = "John Port School",
                    FromYear    = 1990,
                    ToYear      = 1997
                }
            };
            var vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Submitted).WithApplicationTemplate(applicationTemplate).Build();
            var candidate          = new CandidateSummaryBuilder().WithCandidateId(vacancyApplication.CandidateId).Build();

            //Act
            var applicationWithSubVacancy = _applicationMappers.MapApplication(vacancyApplication, candidate.LegacyCandidateId, new Dictionary <Guid, int>(), new Dictionary <int, ApplicationSummary>(), new Dictionary <int, int>(), new Dictionary <int, SubVacancy>());
            var schoolAttendedDictionary  = applicationWithSubVacancy.SchoolAttended.MapSchoolAttendedDictionary();

            //Assert
            schoolAttendedDictionary["SchoolAttendedId"].Should().Be(0);
            schoolAttendedDictionary["CandidateId"].Should().Be(candidate.LegacyCandidateId);
            schoolAttendedDictionary["SchoolId"].Should().Be(null);
            schoolAttendedDictionary["OtherSchoolName"].Should().Be(applicationTemplate.EducationHistory.Institution);
            schoolAttendedDictionary["OtherSchoolTown"].Should().BeNull();
            schoolAttendedDictionary["StartDate"].Should().Be(new DateTime(applicationTemplate.EducationHistory.FromYear, 1, 1));
            schoolAttendedDictionary["EndDate"].Should().Be(new DateTime(applicationTemplate.EducationHistory.ToYear, 1, 1));
            schoolAttendedDictionary["ApplicationId"].Should().Be(vacancyApplication.LegacyApplicationId);
        }
Exemple #3
0
        public void SourceApplicationStatusTypeIdInProgressTest()
        {
            //Arrange
            var       vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Submitted).WithLegacyApplicationId(0).Build();
            var       candidate          = new CandidateSummaryBuilder().WithCandidateId(vacancyApplication.CandidateId).WithLegacyCandidateId(0).Build();
            const int applicationId      = 42;
            var       applicationIds     = new Dictionary <Guid, int>
            {
                { vacancyApplication.Id, applicationId }
            };
            const int applicationStatusTypeIdInProgress = 3;
            var       sourceApplicationSummaries        = new Dictionary <int, ApplicationSummary>
            {
                { applicationId, new ApplicationSummary {
                      ApplicationStatusTypeId = applicationStatusTypeIdInProgress
                  } }
            };

            //Act
            var applicationWithSubVacancy = _applicationMappers.MapApplication(vacancyApplication, candidate.LegacyCandidateId, applicationIds, sourceApplicationSummaries, new Dictionary <int, int>(), new Dictionary <int, SubVacancy>());
            var application = applicationWithSubVacancy.Application;

            //Assert
            application.ApplicationId.Should().Be(applicationId);
            application.CandidateId.Should().Be(candidate.LegacyCandidateId);
            application.ApplicationStatusTypeId.Should().Be(applicationStatusTypeIdInProgress);
            applicationWithSubVacancy.UpdateStatusTo.Should().Be(ApplicationStatuses.InProgress);
        }
Exemple #4
0
        public void SourceApplicationStatusTypeIdSuccessfulTest()
        {
            //Arrange
            var       vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Submitted).WithLegacyApplicationId(0).Build();
            var       candidate          = new CandidateSummaryBuilder().WithCandidateId(vacancyApplication.CandidateId).WithLegacyCandidateId(0).Build();
            const int applicationId      = 42;
            var       applicationIds     = new Dictionary <Guid, int>
            {
                { vacancyApplication.Id, applicationId }
            };
            const int applicationStatusTypeIdInProgress = 3;
            const int applicationStatusTypeIdSuccessful = 6;
            var       sourceApplicationSummaries        = new Dictionary <int, ApplicationSummary>
            {
                { applicationId, new ApplicationSummary {
                      ApplicationStatusTypeId = applicationStatusTypeIdSuccessful
                  } }
            };

            //Act
            var applicationWithSubVacancy = _applicationMappers.MapApplication(vacancyApplication, candidate.LegacyCandidateId, applicationIds, sourceApplicationSummaries, new Dictionary <int, int>(), new Dictionary <int, SubVacancy>());
            var application = applicationWithSubVacancy.Application;

            //Assert
            application.ApplicationId.Should().Be(applicationId);
            application.CandidateId.Should().Be(candidate.LegacyCandidateId);
            application.ApplicationStatusTypeId.Should().Be(applicationStatusTypeIdInProgress);
            applicationWithSubVacancy.UpdateStatusTo.Should().Be(ApplicationStatuses.InProgress);
            //We're going to set old applications with an incorrect outcome to in progress so as not to alert the candidates about older outcomes
            //application.ApplicationStatusTypeId.Should().Be(applicationStatusTypeIdSuccessful);
            //applicationWithSubVacancy.UpdateStatusTo.Should().Be(ApplicationStatuses.Successful);
        }
Exemple #5
0
        public void SourceApplicationOutcomeReasonOtherTest()
        {
            //Arrange
            var       vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Draft).WithLegacyApplicationId(0).Build();
            var       candidate          = new CandidateSummaryBuilder().WithCandidateId(vacancyApplication.CandidateId).WithLegacyCandidateId(0).Build();
            const int applicationId      = 42;
            var       applicationIds     = new Dictionary <Guid, int>
            {
                { vacancyApplication.Id, applicationId }
            };
            const string outcomeReasonOther         = "Failed to attend several first stage interviews";
            var          sourceApplicationSummaries = new Dictionary <int, ApplicationSummary>
            {
                { applicationId, new ApplicationSummary {
                      OutcomeReasonOther = outcomeReasonOther
                  } }
            };

            //Act
            var application = _applicationMappers.MapApplication(vacancyApplication, candidate.LegacyCandidateId, applicationIds, sourceApplicationSummaries, new Dictionary <int, int>(), new Dictionary <int, SubVacancy>()).Application;

            //Assert
            application.ApplicationId.Should().Be(applicationId);
            application.CandidateId.Should().Be(candidate.LegacyCandidateId);
            application.OutcomeReasonOther.Should().Be(outcomeReasonOther);
        }
Exemple #6
0
        public void SubmittedApplicationWithHistoryDictionaryTest()
        {
            //Arrange
            var vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Submitted).Build();
            var candidate          = new CandidateSummaryBuilder().WithCandidateId(vacancyApplication.CandidateId).Build();

            //Act
            var applicationWithHistory       = _applicationMappers.MapApplicationWithHistory(vacancyApplication, candidate.LegacyCandidateId, new Dictionary <Guid, int>(), new Dictionary <int, ApplicationSummary>(), new Dictionary <int, int>(), new Dictionary <int, SubVacancy>(), new Dictionary <int, Dictionary <int, int> >(), new Dictionary <int, List <ApplicationHistorySummary> >());
            var applicationDictionary        = _applicationMappers.MapApplicationDictionary(applicationWithHistory.ApplicationWithSubVacancy.Application);
            var applicationHistoryDictionary = applicationWithHistory.ApplicationHistory.MapApplicationHistoryDictionary();

            //Assert
            applicationDictionary["ApplicationId"].Should().Be(vacancyApplication.LegacyApplicationId);
            applicationDictionary["CandidateId"].Should().Be(candidate.LegacyCandidateId);
            applicationDictionary["VacancyId"].Should().Be(vacancyApplication.Vacancy.Id);
            applicationDictionary["ApplicationStatusTypeId"].Should().Be(2);
            applicationDictionary["WithdrawnOrDeclinedReasonId"].Should().Be(0);
            applicationDictionary["UnsuccessfulReasonId"].Should().Be(0);
            applicationDictionary["OutcomeReasonOther"].Should().Be(null);
            applicationDictionary["NextActionId"].Should().Be(0);
            applicationDictionary["NextActionOther"].Should().Be(null);
            applicationDictionary["AllocatedTo"].Should().Be(null);
            applicationDictionary["CVAttachmentId"].Should().Be(null);
            applicationDictionary["BeingSupportedBy"].Should().Be(null);
            applicationDictionary["LockedForSupportUntil"].Should().Be(null);
            applicationDictionary["WithdrawalAcknowledged"].Should().Be(true);
            applicationDictionary["ApplicationGuid"].Should().Be(vacancyApplication.Id);
            applicationHistoryDictionary.Should().NotBeNull();
            applicationHistoryDictionary.Count.Should().Be(2);
            applicationHistoryDictionary.All(a => (int)a["ApplicationId"] == (int)applicationDictionary["ApplicationId"]).Should().BeTrue();
        }
Exemple #7
0
        public void SuccessfulApplicationWithHistoryTest()
        {
            //Arrange
            var vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Successful).Build();
            var candidate          = new CandidateSummaryBuilder().WithCandidateId(vacancyApplication.CandidateId).Build();

            //Act
            var applicationWithHistory = _applicationMappers.MapApplicationWithHistory(vacancyApplication, candidate.LegacyCandidateId, new Dictionary <Guid, int>(), new Dictionary <int, ApplicationSummary>(), new Dictionary <int, int>(), new Dictionary <int, SubVacancy>(), new Dictionary <int, Dictionary <int, int> >(), new Dictionary <int, List <ApplicationHistorySummary> >());

            //Assert
            applicationWithHistory.ApplicationWithSubVacancy.Application.ApplicationId.Should().Be(vacancyApplication.LegacyApplicationId);
            applicationWithHistory.ApplicationWithSubVacancy.Application.CandidateId.Should().Be(candidate.LegacyCandidateId);
            applicationWithHistory.ApplicationWithSubVacancy.Application.VacancyId.Should().Be(vacancyApplication.Vacancy.Id);
            applicationWithHistory.ApplicationWithSubVacancy.Application.ApplicationStatusTypeId.Should().Be(6);
            applicationWithHistory.ApplicationWithSubVacancy.Application.WithdrawnOrDeclinedReasonId.Should().Be(0);
            applicationWithHistory.ApplicationWithSubVacancy.Application.UnsuccessfulReasonId.Should().Be(0);
            applicationWithHistory.ApplicationWithSubVacancy.Application.OutcomeReasonOther.Should().Be(null);
            applicationWithHistory.ApplicationWithSubVacancy.Application.NextActionId.Should().Be(0);
            applicationWithHistory.ApplicationWithSubVacancy.Application.NextActionOther.Should().Be(null);
            applicationWithHistory.ApplicationWithSubVacancy.Application.AllocatedTo.Should().Be(null);
            applicationWithHistory.ApplicationWithSubVacancy.Application.CVAttachmentId.Should().Be(null);
            applicationWithHistory.ApplicationWithSubVacancy.Application.BeingSupportedBy.Should().Be(null);
            applicationWithHistory.ApplicationWithSubVacancy.Application.LockedForSupportUntil.Should().Be(null);
            applicationWithHistory.ApplicationWithSubVacancy.Application.WithdrawalAcknowledged.Should().Be(true);
            applicationWithHistory.ApplicationWithSubVacancy.Application.ApplicationGuid.Should().Be(vacancyApplication.Id);
            applicationWithHistory.ApplicationHistory.Should().NotBeNullOrEmpty();
            applicationWithHistory.ApplicationHistory.Count.Should().Be(4);
            applicationWithHistory.ApplicationHistory.All(a => a.ApplicationId == applicationWithHistory.ApplicationWithSubVacancy.Application.ApplicationId).Should().BeTrue();
        }
Exemple #8
0
        public void NoLegacyIdsVacancyApplicationTest()
        {
            //Arrange
            var vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Draft).WithLegacyApplicationId(0).Build();
            var candidate          = new CandidateSummaryBuilder().WithCandidateId(vacancyApplication.CandidateId).WithLegacyCandidateId(0).Build();

            //Act
            var application = _applicationMappers.MapApplication(vacancyApplication, candidate.LegacyCandidateId, new Dictionary <Guid, int>(), new Dictionary <int, ApplicationSummary>(), new Dictionary <int, int>(), new Dictionary <int, SubVacancy>()).Application;

            //Assert
            application.ApplicationId.Should().Be(0);
            application.CandidateId.Should().Be(candidate.LegacyCandidateId);
        }
Exemple #9
0
        public void EmptySchoolAttendedTest()
        {
            //Arrange
            var applicationTemplate = new ApplicationTemplate
            {
                EducationHistory = new Education()
            };
            var vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Submitted).WithApplicationTemplate(applicationTemplate).Build();
            var candidate          = new CandidateSummaryBuilder().WithCandidateId(vacancyApplication.CandidateId).Build();

            //Act
            var applicationWithSubVacancy = _applicationMappers.MapApplication(vacancyApplication, candidate.LegacyCandidateId, new Dictionary <Guid, int>(), new Dictionary <int, ApplicationSummary>(), new Dictionary <int, int>(), new Dictionary <int, SubVacancy>());

            //Assert
            applicationWithSubVacancy.SchoolAttended.Should().BeNull();
        }
Exemple #10
0
        public void AllocatedToTest(string notes)
        {
            //Arrange
            var       vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Draft).WithLegacyApplicationId(0).WithNotes(notes).Build();
            var       candidate          = new CandidateSummaryBuilder().WithCandidateId(vacancyApplication.CandidateId).WithLegacyCandidateId(0).Build();
            const int applicationId      = 42;
            var       applicationIds     = new Dictionary <Guid, int>
            {
                { vacancyApplication.Id, applicationId }
            };
            const string allocatedTo = "registration completed. CV to be sent to employer ";
            var          sourceApplicationSummaries = new Dictionary <int, ApplicationSummary>
            {
                { applicationId, new ApplicationSummary {
                      AllocatedTo = allocatedTo
                  } }
            };

            //Act
            var applicationWithSubVacancy = _applicationMappers.MapApplication(vacancyApplication, candidate.LegacyCandidateId, applicationIds, sourceApplicationSummaries, new Dictionary <int, int>(), new Dictionary <int, SubVacancy>());
            var application = applicationWithSubVacancy.Application;

            //Assert
            application.ApplicationId.Should().Be(applicationId);
            application.CandidateId.Should().Be(candidate.LegacyCandidateId);
            if (string.IsNullOrEmpty(notes))
            {
                application.AllocatedTo.Should().Be(allocatedTo);
                applicationWithSubVacancy.UpdateNotes.Should().BeTrue();
            }
            else
            {
                application.AllocatedTo.Should().Be(notes);
                applicationWithSubVacancy.UpdateNotes.Should().BeFalse();
            }
        }