Пример #1
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);
        }
Пример #2
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);
        }
Пример #3
0
        public void SuccessfulVacancyApplicationDictionaryTest()
        {
            //Arrange
            var vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Successful).Build();

            //Act
            var applicationHistory           = vacancyApplication.MapApplicationHistory(vacancyApplication.LegacyApplicationId, new Dictionary <int, Dictionary <int, int> >(), new Dictionary <int, List <ApplicationHistorySummary> >());
            var applicationHistoryDictionary = applicationHistory.MapApplicationHistoryDictionary();

            //Assert
            applicationHistoryDictionary.Should().NotBeNullOrEmpty();
            applicationHistoryDictionary.Count.Should().Be(4);
            var draftHistory = applicationHistoryDictionary[0];

            draftHistory["ApplicationHistoryEventSubTypeId"].Should().Be(1);
            var submittedHistory = applicationHistoryDictionary[1];

            submittedHistory["ApplicationHistoryEventSubTypeId"].Should().Be(2);
            var inProgressHistory = applicationHistoryDictionary[2];

            inProgressHistory["ApplicationHistoryEventSubTypeId"].Should().Be(3);
            var successfulHistory = applicationHistoryDictionary[3];

            successfulHistory["ApplicationId"].Should().Be(vacancyApplication.LegacyApplicationId);
            successfulHistory["UserName"].Should().Be("");
            // ReSharper disable once PossibleInvalidOperationException
            successfulHistory["ApplicationHistoryEventDate"].Should().Be(vacancyApplication.SuccessfulDateTime.Value);
            successfulHistory["ApplicationHistoryEventTypeId"].Should().Be(1);
            successfulHistory["ApplicationHistoryEventSubTypeId"].Should().Be(6);
            successfulHistory["Comment"].Should().Be("Status Change");
        }
Пример #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);
        }
Пример #5
0
        public void SourceSubVacancyTest()
        {
            //Arrange
            const int legacyApplicationId = 42;
            var       vacancyApplication  = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Unsuccessful).WithLegacyApplicationId(legacyApplicationId).Build();
            const int applicationId       = -42;
            var       applicationIds      = new Dictionary <Guid, int>
            {
                { vacancyApplication.Id, applicationId }
            };
            var subVacancy = new SubVacancy {
                SubVacancyId = 1, VacancyId = 2, AllocatedApplicationId = legacyApplicationId, StartDate = DateTime.Now.AddDays(7)
            };
            var sourceSubVacancies = new Dictionary <int, SubVacancy>
            {
                { legacyApplicationId, subVacancy }
            };

            //Act
            var application = _applicationMappers.MapApplication(vacancyApplication, legacyApplicationId, applicationIds, new Dictionary <int, ApplicationSummary>(), new Dictionary <int, int>(), sourceSubVacancies);

            //Assert
            application.Application.ApplicationId.Should().Be(applicationId);
            application.SubVacancy.Should().NotBeNull();
            application.SubVacancy.Should().Be(subVacancy);
        }
Пример #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();
        }
Пример #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();
        }
Пример #8
0
        public void SourceSubVacancyDictionaryTest()
        {
            //Arrange
            const int legacyApplicationId = 42;
            var       vacancyApplication  = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Unsuccessful).WithLegacyApplicationId(legacyApplicationId).Build();
            const int applicationId       = -42;
            var       applicationIds      = new Dictionary <Guid, int>
            {
                { vacancyApplication.Id, applicationId }
            };
            var subVacancy = new SubVacancy {
                SubVacancyId = 1, VacancyId = 2, AllocatedApplicationId = legacyApplicationId, StartDate = DateTime.Now.AddDays(7), ILRNumber = "123456"
            };
            var sourceSubVacancies = new Dictionary <int, SubVacancy>
            {
                { legacyApplicationId, subVacancy }
            };

            //Act
            var applicationWithHistory = _applicationMappers.MapApplicationWithHistory(vacancyApplication, legacyApplicationId, applicationIds, new Dictionary <int, ApplicationSummary>(), new Dictionary <int, int>(), sourceSubVacancies, new Dictionary <int, Dictionary <int, int> >(), new Dictionary <int, List <ApplicationHistorySummary> >());
            var subVacancyDictionary   = _applicationMappers.MapSubVacancyDictionary(applicationWithHistory.ApplicationWithSubVacancy.SubVacancy);

            //Assert
            subVacancyDictionary["SubVacancyId"].Should().Be(subVacancy.SubVacancyId);
            subVacancyDictionary["VacancyId"].Should().Be(subVacancy.VacancyId);
            subVacancyDictionary["AllocatedApplicationId"].Should().Be(subVacancy.AllocatedApplicationId);
            subVacancyDictionary["StartDate"].Should().Be(subVacancy.StartDate);
            subVacancyDictionary["ILRNumber"].Should().Be(subVacancy.ILRNumber);
        }
Пример #9
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);
        }
Пример #10
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);
        }
Пример #11
0
        public void InProgressVacancyApplicationTest()
        {
            //Arrange
            var vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.InProgress).Build();

            //Act
            var applicationHistory = vacancyApplication.MapApplicationHistory(vacancyApplication.LegacyApplicationId, new Dictionary <int, Dictionary <int, int> >(), new Dictionary <int, List <ApplicationHistorySummary> >());

            //Assert
            applicationHistory.Should().NotBeNullOrEmpty();
            applicationHistory.Count.Should().Be(3);
            var draftHistory = applicationHistory[0];

            draftHistory.ApplicationHistoryEventSubTypeId.Should().Be(1);
            var submittedHistory = applicationHistory[1];

            submittedHistory.ApplicationHistoryEventSubTypeId.Should().Be(2);
            var inProgressHistory = applicationHistory[2];

            inProgressHistory.ApplicationId.Should().Be(vacancyApplication.LegacyApplicationId);
            inProgressHistory.UserName.Should().Be("");
            // ReSharper disable once PossibleInvalidOperationException
            inProgressHistory.ApplicationHistoryEventDate.Should().Be(vacancyApplication.DateUpdated.Value);
            inProgressHistory.ApplicationHistoryEventTypeId.Should().Be(1);
            inProgressHistory.ApplicationHistoryEventSubTypeId.Should().Be(3);
            inProgressHistory.Comment.Should().Be("Status Change");
        }
Пример #12
0
        public void NoApplicationIdVacancyApplicationTest()
        {
            //Arrange
            var vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Draft).WithLegacyApplicationId(0).Build();

            //Act
            var applicationHistory = vacancyApplication.MapApplicationHistory(vacancyApplication.LegacyApplicationId, new Dictionary <int, Dictionary <int, int> >(), new Dictionary <int, List <ApplicationHistorySummary> >());

            //Assert
            applicationHistory[0].ApplicationHistoryId.Should().Be(0);
        }
Пример #13
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);
        }
Пример #14
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();
        }
Пример #15
0
        public void SubmittingVacancyApplicationTest()
        {
            //Arrange
            var vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Submitting).Build();

            //Act
            var applicationHistory = vacancyApplication.MapApplicationHistory(vacancyApplication.LegacyApplicationId, new Dictionary <int, Dictionary <int, int> >(), new Dictionary <int, List <ApplicationHistorySummary> >());

            //Assert
            applicationHistory.Should().NotBeNullOrEmpty();
            applicationHistory.Count.Should().Be(1);
            var draftHistory = applicationHistory.First();

            draftHistory.ApplicationId.Should().Be(vacancyApplication.LegacyApplicationId);
            draftHistory.UserName.Should().Be("");
            draftHistory.ApplicationHistoryEventDate.Should().Be(vacancyApplication.DateCreated);
            draftHistory.ApplicationHistoryEventTypeId.Should().Be(1);
            draftHistory.ApplicationHistoryEventSubTypeId.Should().Be(1);
            draftHistory.Comment.Should().Be("Status Change");
        }
Пример #16
0
        public void MatchingApplicationIdVacancyApplicationTest()
        {
            //Arrange
            const int applicationId         = 42;
            const int applicationHistoryId  = 43;
            var       vacancyApplication    = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Submitted).WithLegacyApplicationId(applicationId).Build();
            var       applicationHistoryIds = new Dictionary <int, Dictionary <int, int> >
            {
                { applicationId, new Dictionary <int, int> {
                      { 1, applicationHistoryId }
                  } }
            };

            //Act
            var applicationHistory = vacancyApplication.MapApplicationHistory(vacancyApplication.LegacyApplicationId, applicationHistoryIds, new Dictionary <int, List <ApplicationHistorySummary> >());

            //Assert
            applicationHistory[0].ApplicationHistoryId.Should().Be(43);
            applicationHistory[1].ApplicationHistoryId.Should().Be(0);
        }
Пример #17
0
        public void SourceSchoolAttendedTest()
        {
            //Arrange
            const int legacyApplicationId = 42;
            const int legacyCandidateId   = 43;
            var       applicationTemplate = new ApplicationTemplate
            {
                EducationHistory = new Education
                {
                    Institution = "John Port School",
                    FromYear    = 1990,
                    ToYear      = 1997
                }
            };
            var       vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Submitted).WithLegacyApplicationId(legacyApplicationId).WithApplicationTemplate(applicationTemplate).Build();
            const int applicationId      = -42;
            var       applicationIds     = new Dictionary <Guid, int>
            {
                { vacancyApplication.Id, applicationId }
            };
            const int schoolAttendedId  = 44;
            var       schoolAttendedIds = new Dictionary <int, int>
            {
                { applicationId, schoolAttendedId }
            };

            //Act
            var applicationWithSubVacancy = _applicationMappers.MapApplication(vacancyApplication, legacyCandidateId, applicationIds, new Dictionary <int, ApplicationSummary>(), schoolAttendedIds, new Dictionary <int, SubVacancy>());

            //Assert
            applicationWithSubVacancy.SchoolAttended.Should().NotBeNull();
            applicationWithSubVacancy.SchoolAttended.SchoolAttendedId.Should().Be(schoolAttendedId);
            applicationWithSubVacancy.SchoolAttended.CandidateId.Should().Be(legacyCandidateId);
            applicationWithSubVacancy.SchoolAttended.SchoolId.Should().Be(null);
            applicationWithSubVacancy.SchoolAttended.OtherSchoolName.Should().Be(applicationTemplate.EducationHistory.Institution);
            applicationWithSubVacancy.SchoolAttended.OtherSchoolTown.Should().BeNull();
            applicationWithSubVacancy.SchoolAttended.StartDate.Should().Be(new DateTime(applicationTemplate.EducationHistory.FromYear, 1, 1));
            applicationWithSubVacancy.SchoolAttended.EndDate.Should().Be(new DateTime(applicationTemplate.EducationHistory.ToYear, 1, 1));
            applicationWithSubVacancy.SchoolAttended.ApplicationId.Should().Be(applicationId);
        }
Пример #18
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();
            }
        }
Пример #19
0
        public void SuccessfulVacancyApplicationDateFromSourceTest()
        {
            //Arrange
            const int applicationId         = 42;
            const int applicationHistoryId  = 43;
            var       applicationHistoryIds = new Dictionary <int, Dictionary <int, int> >
            {
                { applicationId, new Dictionary <int, int> {
                      { 6, applicationHistoryId }
                  } }
            };
            var vacancyApplication = new VacancyApplicationBuilder().WithStatus(ApplicationStatuses.Successful).WithLegacyApplicationId(applicationId).Build();
            var successfulDateTime = DateTime.Now.AddDays(-2);
            var sourceApplicationHistorySummaries = new Dictionary <int, List <ApplicationHistorySummary> >
            {
                {
                    applicationId, new List <ApplicationHistorySummary>
                    {
                        new ApplicationHistorySummary {
                            ApplicationHistoryEventSubTypeId = 6, ApplicationHistoryEventDate = successfulDateTime.AddHours(-3)
                        },
                        new ApplicationHistorySummary {
                            ApplicationHistoryEventSubTypeId = 6, ApplicationHistoryEventDate = successfulDateTime
                        }
                    }
                }
            };

            //Act
            var applicationHistory = vacancyApplication.MapApplicationHistory(vacancyApplication.LegacyApplicationId, applicationHistoryIds, sourceApplicationHistorySummaries);

            //Assert
            var successfulHistory = applicationHistory[3];

            successfulHistory.ApplicationHistoryEventDate.Should().Be(successfulDateTime);
        }