public void Then_days_in_learning_is_created_with_the_expected_number_of_days_when_the_collection_period_census_date_is_before_the_last_LearningPeriod_end_date()
        {
            // arrange
            _learningPeriod3 = new LearningPeriod(_learningPeriod3.StartDate, _censusDate.AddDays(1));
            _learningPeriods = new List <LearningPeriod>()
            {
                new LearningPeriod(_startDate.AddDays(-60), _startDate.AddDays(-60 + 15)),
                new LearningPeriod(_startDate.AddDays(-30), _startDate.AddDays(-30 + 12)),
                _learningPeriod3
            };
            _sutModel = _fixture
                        .Build <LearnerModel>()
                        .With(l => l.LearningPeriods, _learningPeriods)
                        .With(l => l.DaysInLearnings, new List <DaysInLearning>())
                        .Create();

            int expectedDays = 18 + 16 + 13;

            _sut = Sut(_sutModel);

            // act
            _sut.SetDaysInLearning(_collectionPeriod);

            // assert
            var daysInLearning = _sut.GetModel().DaysInLearnings.Single();

            daysInLearning.CollectionYear.Should().Be(_collectionPeriod.AcademicYear);
            daysInLearning.CollectionPeriodNumber.Should().Be(_collectionPeriod.PeriodNumber);
            daysInLearning.NumberOfDays.Should().Be(expectedDays);
        }
Пример #2
0
        public void Initilize()
        {
            // 获取走班
            var cl = CommonDataManager.GetCLCase(base.LocalID);

            this.SelectLearningPeriod = cl.LearningPeriod;
            this.School  = cl.SchoolName;
            this.Version = cl.Version;
        }
Пример #3
0
        public void Then_learning_periods_are_created()
        {
            // arrange
            var period1        = new LearningPeriod(_fixture.Create <DateTime>(), _fixture.Create <DateTime>());
            var period2        = new LearningPeriod(_fixture.Create <DateTime>(), null);
            var period3        = new LearningPeriod(_fixture.Create <DateTime>(), _fixture.Create <DateTime>());
            var leaningPeriods = new List <LearningPeriod>()
            {
                period1, period2, period3
            };

            // act
            _sut.SetLearningPeriods(leaningPeriods);

            // assert
            var model = _sut.GetModel();

            model.LearningPeriods.Count.Should().Be(3);

            model.LearningPeriods.Single(p => p.StartDate == period1.StartDate && p.EndDate == period1.EndDate);
            model.LearningPeriods.Single(p => p.StartDate == period2.StartDate && p.EndDate == null);
            model.LearningPeriods.Single(p => p.StartDate == period3.StartDate && p.EndDate == period3.EndDate);
        }
        public void Arrange()
        {
            _fixture    = new Fixture();
            _startDate  = DateTime.Now.Date;
            _censusDate = _startDate.AddDays(17);

            _collectionPeriod = new CollectionPeriod(1, (byte)DateTime.Now.Month, (short)DateTime.Now.Year, DateTime.Now.AddMonths(-2), _censusDate, (short)DateTime.Now.Year, true);

            _learningPeriod3 = new LearningPeriod(_startDate, null);
            _learningPeriods = new List <LearningPeriod>()
            {
                new LearningPeriod(_startDate.AddDays(-60), _startDate.AddDays(-60 + 15)),
                new LearningPeriod(_startDate.AddDays(-30), _startDate.AddDays(-30 + 12)),
                _learningPeriod3
            };

            _sutModel = _fixture
                        .Build <LearnerModel>()
                        .With(l => l.LearningPeriods, _learningPeriods)
                        .With(l => l.DaysInLearnings, new List <DaysInLearning>())
                        .Create();

            _sut = Sut(_sutModel);
        }
Пример #5
0
        public void Then_existing_periods_are_replaced()
        {
            // arrange
            _sutModel.LearningPeriods.Add(new LearningPeriod(_fixture.Create <DateTime>(), _fixture.Create <DateTime>()));
            _sutModel.LearningPeriods.Add(new LearningPeriod(_fixture.Create <DateTime>(), _fixture.Create <DateTime>()));

            _sut = Sut(_sutModel);

            var period1        = new LearningPeriod(_fixture.Create <DateTime>(), _fixture.Create <DateTime>());
            var leaningPeriods = new List <LearningPeriod>()
            {
                period1
            };

            // act
            _sut.SetLearningPeriods(leaningPeriods);

            // assert
            var model = _sut.GetModel();

            model.LearningPeriods.Count.Should().Be(1);

            model.LearningPeriods.Single(p => p.StartDate == period1.StartDate && p.EndDate == period1.EndDate);
        }
Пример #6
0
        public LearningStoppedSteps(TestContext testContext)
        {
            _testContext = testContext;
            _fixture     = new Fixture();

            _plannedStartDate = new DateTime(2020, 8, 1);
            _breakInLearning  = 15;
            _accountModel     = _fixture.Create <Account>();

            _apprenticeshipIncentive = _fixture.Build <ApprenticeshipIncentive>()
                                       .With(p => p.DateOfBirth, _plannedStartDate.AddYears(-24).AddMonths(-10)) // under 25
                                       .With(p => p.AccountId, _accountModel.Id)
                                       .With(p => p.AccountLegalEntityId, _accountModel.AccountLegalEntityId)
                                       .With(p => p.HasPossibleChangeOfCircumstances, false)
                                       .With(p => p.StartDate, new DateTime(2020, 11, 1))
                                       .With(p => p.Phase, Phase.Phase1)
                                       .Create();

            _pendingPayment = _fixture.Build <PendingPayment>()
                              .With(p => p.AccountId, _accountModel.Id)
                              .With(p => p.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id)
                              .With(p => p.DueDate, _plannedStartDate.AddMonths(1))
                              .With(p => p.ClawedBack, false)
                              .With(p => p.EarningType, EarningType.FirstPayment)
                              .Without(p => p.PaymentMadeDate)
                              .Create();

            _periodEndDate = DateTime.Today.AddDays(-10);

            _learner = _fixture
                       .Build <Learner>()
                       .With(p => p.ApprenticeshipId, _apprenticeshipIncentive.ApprenticeshipId)
                       .With(p => p.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id)
                       .With(p => p.ULN, _apprenticeshipIncentive.ULN)
                       .With(p => p.Ukprn, _apprenticeshipIncentive.UKPRN)
                       .With(p => p.LearningFound, true)
                       .With(p => p.StartDate, _plannedStartDate.AddDays(-10))
                       .Create();

            _learningPeriod1 = _fixture
                               .Build <LearningPeriod>()
                               .With(p => p.LearnerId, _learner.Id)
                               .With(p => p.StartDate, _plannedStartDate.AddDays(-20).AddDays(_breakInLearning * -1))
                               .With(p => p.EndDate, _plannedStartDate.AddDays(-10).AddDays(_breakInLearning * -1))
                               .Create();

            _stoppedLearnerMatchApiData = _fixture
                                          .Build <LearnerSubmissionDto>()
                                          .With(s => s.Ukprn, _apprenticeshipIncentive.UKPRN)
                                          .With(s => s.Uln, _apprenticeshipIncentive.ULN)
                                          .With(l => l.Training, new List <TrainingDto> {
                _fixture
                .Build <TrainingDto>()
                .With(p => p.Reference, "ZPROG001")
                .With(p => p.PriceEpisodes, new List <PriceEpisodeDto>()
                {
                    _fixture.Build <PriceEpisodeDto>()
                    .With(pe => pe.Periods, new List <PeriodDto>()
                    {
                        _fixture.Build <PeriodDto>()
                        .With(period => period.ApprenticeshipId, _apprenticeshipIncentive.ApprenticeshipId)
                        .With(period => period.IsPayable, true)
                        .With(period => period.Period, _pendingPayment.PeriodNumber)
                        .Create()
                    })
                    .With(pe => pe.StartDate, _plannedStartDate)
                    .With(pe => pe.EndDate, _periodEndDate)
                    .Create()
                }
                      )
                .Create()
            }
                                                )
                                          .Create();

            _resumedLearnerMatchApiData = _fixture
                                          .Build <LearnerSubmissionDto>()
                                          .With(s => s.Ukprn, _apprenticeshipIncentive.UKPRN)
                                          .With(s => s.Uln, _apprenticeshipIncentive.ULN)
                                          .With(l => l.Training, new List <TrainingDto> {
                _fixture
                .Build <TrainingDto>()
                .With(p => p.Reference, "ZPROG001")
                .With(p => p.PriceEpisodes, new List <PriceEpisodeDto>()
                {
                    _fixture.Build <PriceEpisodeDto>()
                    .With(pe => pe.Periods, new List <PeriodDto>()
                    {
                        _fixture.Build <PeriodDto>()
                        .With(period => period.ApprenticeshipId, _apprenticeshipIncentive.ApprenticeshipId)
                        .With(period => period.IsPayable, true)
                        .With(period => period.Period, _pendingPayment.PeriodNumber)
                        .Create()
                    })
                    .With(pe => pe.StartDate, _plannedStartDate)
                    .With(pe => pe.EndDate, DateTime.Today.AddDays(10))
                    .Create()
                }
                      )
                .Create()
            }
                                                )
                                          .Create();

            _resumedLearnerWithBreakInLearningMatchApiData = _fixture
                                                             .Build <LearnerSubmissionDto>()
                                                             .With(s => s.Ukprn, _apprenticeshipIncentive.UKPRN)
                                                             .With(s => s.Uln, _apprenticeshipIncentive.ULN)
                                                             .With(l => l.Training, new List <TrainingDto> {
                _fixture
                .Build <TrainingDto>()
                .With(p => p.Reference, "ZPROG001")
                .With(p => p.PriceEpisodes, new List <PriceEpisodeDto>()
                {
                    _fixture.Build <PriceEpisodeDto>()
                    .With(pe => pe.Periods, new List <PeriodDto>()
                    {
                        _fixture.Build <PeriodDto>()
                        .With(period => period.ApprenticeshipId, _apprenticeshipIncentive.ApprenticeshipId)
                        .With(period => period.IsPayable, true)
                        .With(period => period.Period, _pendingPayment.PeriodNumber)
                        .Create()
                    })
                    .With(pe => pe.StartDate, _plannedStartDate)
                    .With(pe => pe.EndDate, DateTime.Today.AddDays(_breakInLearning * -1))
                    .Create(),
                    _fixture.Build <PriceEpisodeDto>()
                    .With(pe => pe.Periods, new List <PeriodDto>()
                    {
                        _fixture.Build <PeriodDto>()
                        .With(period => period.ApprenticeshipId, _apprenticeshipIncentive.ApprenticeshipId)
                        .With(period => period.IsPayable, true)
                        .With(period => period.Period, _pendingPayment.PeriodNumber)
                        .Create()
                    })
                    .With(pe => pe.StartDate, DateTime.Today)
                    .With(pe => pe.EndDate, DateTime.Today.AddDays(10))
                    .Create()
                }
                      )
                .Create()
            }
                                                                   )
                                                             .Create();

            _apprenticeshipBreakInLearning = _fixture
                                             .Build <ApprenticeshipBreakInLearning>()
                                             .With(b => b.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id)
                                             .With(b => b.StartDate, _plannedStartDate.AddDays(_breakInLearning * -1))
                                             .With(b => b.EndDate, (DateTime?)null)
                                             .Create();

            _resumedLearnerWithIncorrectlyRecordedBreakInLearningMatchApiData = _fixture
                                                                                .Build <LearnerSubmissionDto>()
                                                                                .With(s => s.Ukprn, _apprenticeshipIncentive.UKPRN)
                                                                                .With(s => s.Uln, _apprenticeshipIncentive.ULN)
                                                                                .With(l => l.Training, new List <TrainingDto>
            {
                _fixture
                .Build <TrainingDto>()
                .With(p => p.Reference, "ZPROG001")
                .With(p => p.PriceEpisodes, new List <PriceEpisodeDto>()
                {
                    _fixture.Build <PriceEpisodeDto>()
                    .With(pe => pe.Periods, new List <PeriodDto>()
                    {
                        _fixture.Build <PeriodDto>()
                        .With(period => period.ApprenticeshipId,
                              _apprenticeshipIncentive.ApprenticeshipId)
                        .With(period => period.IsPayable, true)
                        .With(period => period.Period, _pendingPayment.PeriodNumber)
                        .Create()
                    })
                    .With(pe => pe.StartDate, _apprenticeshipBreakInLearning.StartDate)
                    .With(pe => pe.EndDate, DateTime.Today.AddMonths(12))
                    .Create(),
                }
                      )
                .Create()
            }
                                                                                      )
                                                                                .Create();
        }