private static BreakInLearning Map(this ApprenticeshipBreakInLearning model) { var newBreakInLearning = new BreakInLearning(model.StartDate); if (model.EndDate.HasValue) { newBreakInLearning.SetEndDate(model.EndDate.Value); } return(newBreakInLearning); }
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(); }
public LearningResumedSteps(TestContext testContext) { _testContext = testContext; _fixture = new Fixture(); _plannedStartDate = new DateTime(2020, 11, 10); _breakInLearning = 15; _accountModel = _fixture.Create <Account>(); _periodNumber = 1; _apprenticeshipIncentive = _fixture.Build <ApprenticeshipIncentive>() .With(p => p.DateOfBirth, new DateTime(1995, 10, 15)) // under 25 .With(p => p.AccountId, _accountModel.Id) .With(p => p.AccountLegalEntityId, _accountModel.AccountLegalEntityId) .With(p => p.HasPossibleChangeOfCircumstances, false) .With(p => p.StartDate, _plannedStartDate) .With(p => p.RefreshedLearnerForEarnings, true) .With(p => p.PausePayments, false) .With(p => p.Status, IncentiveStatus.Stopped) .With(p => p.BreakInLearnings, new List <ApprenticeshipBreakInLearning>()) .With(p => p.Phase, Phase.Phase1) .Create(); _apprenticeshipBreakInLearning = _fixture .Build <ApprenticeshipBreakInLearning>() .With(b => b.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id) .With(b => b.StartDate, new DateTime(2021, 02, 08)) .With(b => b.EndDate, (DateTime?)null) .Create(); _pendingPayment = _fixture.Build <PendingPayment>() .With(p => p.AccountId, _accountModel.Id) .With(p => p.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id) .With(p => p.DueDate, new DateTime(2021, 02, 07)) .With(p => p.ClawedBack, false) .With(p => p.EarningType, EarningType.FirstPayment) .With(p => p.PaymentYear, (short)2021) .With(p => p.PeriodNumber, (byte)7) .With(p => p.Amount, 750) .Without(p => p.PaymentMadeDate) .Create(); _payment = _fixture.Build <Payment>() .With(d => d.PendingPaymentId, _pendingPayment.Id) .With(d => d.AccountId, _accountModel.Id) .With(d => d.AccountLegalEntityId, _accountModel.AccountLegalEntityId) .With(d => d.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id) .With(d => d.PaymentPeriod, _pendingPayment.PeriodNumber) .With(d => d.PaymentYear, _pendingPayment.PaymentYear) .With(d => d.PaidDate, _pendingPayment.DueDate) .With(d => d.Amount, _pendingPayment.Amount) .Create(); _clawbackPayment = _fixture.Build <ClawbackPayment>() .With(d => d.PendingPaymentId, _pendingPayment.Id) .With(d => d.PaymentId, _payment.Id) .With(d => d.DateClawbackSent, _pendingPayment.DueDate.AddDays(5)) .With(d => d.AccountId, _accountModel.Id) .With(d => d.AccountLegalEntityId, _accountModel.AccountLegalEntityId) .With(d => d.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id) .With(d => d.CollectionPeriod, _pendingPayment.PeriodNumber) .With(d => d.CollectionPeriodYear, _pendingPayment.PaymentYear) .Create(); }