Пример #1
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");
        }
Пример #2
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");
        }
Пример #3
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);
        }
Пример #4
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");
        }
Пример #5
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);
        }
Пример #6
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);
        }