public async Task Then_the_the_payment_amounts_and_earning_type_is_set_regardless_of_breaks_in_learning(int age, decimal expectedAmount1, decimal expectedAmount2) { var date = new DateTime(2020, 10, 1); const int breakInLearning = 10; var breaks = new List <BreakInLearning> { new BreakInLearning(date).SetEndDate(date.AddDays(breakInLearning)) }; var apprenticeshipIncentive = new ApprenticeshipIncentiveBuilder() .WithStartDate(date) .WithBreaksInLearning(breaks) .WithIncentivePhase(new IncentivePhase(Phase.Phase1)) .WithApprenticeship( new ApprenticeshipBuilder() .WithDateOfBirth(date.AddYears(-1 * age)) .Build()) .Build(); var result = await Incentive.Create(apprenticeshipIncentive, _mockIncentivePaymentProfileService.Object); result.IsEligible.Should().BeTrue(); var payments = result.Payments.ToList(); payments.Count.Should().Be(2); payments[0].Amount.Should().Be(expectedAmount1); payments[0].EarningType.Should().Be(EarningType.FirstPayment); payments[1].Amount.Should().Be(expectedAmount2); payments[1].EarningType.Should().Be(EarningType.SecondPayment); }
public async Task Then_the_properties_are_set_correctly(int age, IncentiveType expectedIncentiveType, decimal expectedAmount1, int expectedDays1, decimal expectedAmount2, int expectedDays2) { var date = new DateTime(2020, 10, 1); var apprenticeshipIncentive = new ApprenticeshipIncentiveBuilder() .WithStartDate(date) .WithIncentivePhase(new IncentivePhase(Phase.Phase1)) .WithApprenticeship( new ApprenticeshipBuilder() .WithDateOfBirth(date.AddYears(-1 * age)) .Build()) .Build(); var result = await Incentive.Create(apprenticeshipIncentive, _mockIncentivePaymentProfileService.Object); result.IsEligible.Should().BeTrue(); var payments = result.Payments.ToList(); payments.Count().Should().Be(2); payments[0].Amount.Should().Be(expectedAmount1); payments[0].PaymentDate.Should().Be(date.AddDays(expectedDays1)); payments[0].EarningType.Should().Be(EarningType.FirstPayment); payments[1].Amount.Should().Be(expectedAmount2); payments[1].PaymentDate.Should().Be(date.AddDays(expectedDays2)); payments[1].EarningType.Should().Be(EarningType.SecondPayment); }
public async Task And_Date_Is_After_May_Then_the_application_is_not_eligible() { var date = new DateTime(2021, 06, 1); var apprenticeshipIncentive = new ApprenticeshipIncentiveBuilder() .WithStartDate(date) .WithIncentivePhase(new IncentivePhase(Phase.Phase1)) .WithApprenticeship( new ApprenticeshipBuilder() .WithDateOfBirth(date.AddYears(-1 * 25)) .Build()) .Build(); var result = await Incentive.Create(apprenticeshipIncentive, _mockIncentivePaymentProfileService.Object); result.IsEligible.Should().BeFalse(); var payments = result.Payments.ToList(); payments.Count.Should().Be(0); }
public async Task Then_the_payment_due_date_considers_breaks_in_learning(GenerateEarningsTestCase @case) { var apprenticeshipIncentive = new ApprenticeshipIncentiveBuilder() .WithStartDate(StartDate) .WithBreaksInLearning(@case.BreaksInLearning) .WithIncentivePhase(new IncentivePhase(Phase.Phase1)) .WithApprenticeship( new ApprenticeshipBuilder() .WithDateOfBirth(StartDate.AddYears(-21)) .Build()) .Build(); var result = await Incentive.Create(apprenticeshipIncentive, _mockIncentivePaymentProfileService.Object); result.IsEligible.Should().BeTrue(); var payments = result.Payments.ToList(); payments.Count.Should().Be(2); payments[0].PaymentDate.Should().Be(StartDate.AddDays(@case.FirstPaymentDays)); payments[1].PaymentDate.Should().Be(StartDate.AddDays(@case.SecondPaymentDays)); }