public void AndMultipleApprenticeshipsThenApprenticeshipsOverFundingLimitIsCalculatedCorrectly() { var apprenticeships = new[] { new ApprenticeshipListItemViewModel { StartDate = new DateTime(2020, 2, 2), Cost = TestTrainingProgrammeFundingCap - 1 }, new ApprenticeshipListItemViewModel { StartDate = new DateTime(2020, 2, 3), Cost = TestTrainingProgrammeFundingCap }, new ApprenticeshipListItemViewModel { StartDate = new DateTime(2020, 2, 4), Cost = TestTrainingProgrammeFundingCap + 1 }, }; var group = new ApprenticeshipListItemGroupViewModel(apprenticeships, _testTrainingProgramme); Assert.AreEqual(1, group.ApprenticeshipsOverFundingLimit); }
public void AndSingleApprenticeshipThenApprenticeshipsOverFundingLimitIsCalculatedCorrectly( DateTime?apprenticeshipStartDate, decimal apprenticeshipCost, DateTime?fundingPeriodFrom, DateTime?fundingPeriodTo, int fundingCap, int expectedApprenticeshipsOverFundingLimit) { var apprenticeships = new[] { new ApprenticeshipListItemViewModel { StartDate = apprenticeshipStartDate, Cost = apprenticeshipCost } }; var trainingProgram = new TrainingProgramme { FundingPeriods = new List <TrainingProgrammeFundingPeriod> { new TrainingProgrammeFundingPeriod { EffectiveFrom = fundingPeriodFrom, EffectiveTo = fundingPeriodTo, FundingCap = fundingCap } }, EffectiveFrom = fundingPeriodFrom, EffectiveTo = fundingPeriodTo }; var group = new ApprenticeshipListItemGroupViewModel(apprenticeships, trainingProgram); Assert.AreEqual(expectedApprenticeshipsOverFundingLimit, group.ApprenticeshipsOverFundingLimit); }
public void AndNoApprenticeshipsThenThereAreNoApprenticeshipsOverFundingLimit() { var trainingProgram = new TrainingProgramme(); var group = new ApprenticeshipListItemGroupViewModel(new ApprenticeshipListItemViewModel[0], trainingProgram); Assert.AreEqual(0, group.ApprenticeshipsOverFundingLimit); }
public void AndSingleApprenticeshipOverFundingLimitThenShowCommonFundingCap() { _singleApprenticeship.First().Cost = TestTrainingProgrammeFundingCap + 1; var group = new ApprenticeshipListItemGroupViewModel(_singleApprenticeship, _testTrainingProgramme); Assert.AreEqual(true, group.ShowCommonFundingCap); }
public void AndNoApprenticeshipsThenDontShowCommonFundingCap() { var apprenticeships = new ApprenticeshipListItemViewModel[0]; var group = new ApprenticeshipListItemGroupViewModel(apprenticeships, _testTrainingProgramme); Assert.AreEqual(false, group.ShowCommonFundingCap); }
public void AndNoApprenticeshipsThenThereIsNoCommonFundingCap() { var apprenticeships = new ApprenticeshipListItemViewModel[0]; var group = new ApprenticeshipListItemGroupViewModel(apprenticeships, _testTrainingProgramme); Assert.AreEqual(null, group.CommonFundingCap); }
public void AndSingleApprenticeshipWithStartDateOutsideFundingBandsThenDontShowCommonFundingCap() { var firstApprenticeship = _singleApprenticeship.First(); firstApprenticeship.StartDate = new DateTime(2000, 1, 1); firstApprenticeship.Cost = TestTrainingProgrammeFundingCap + 1; var group = new ApprenticeshipListItemGroupViewModel(_singleApprenticeship, _testTrainingProgramme); Assert.AreEqual(false, group.ShowCommonFundingCap); }
public void AndSingleApprenticeshipThenTheCommonFundingCapShouldBeSet() { var apprenticeships = new[] { new ApprenticeshipListItemViewModel { StartDate = new DateTime(2020, 2, 2) } }; var group = new ApprenticeshipListItemGroupViewModel(apprenticeships, _testTrainingProgramme); Assert.AreEqual(TestTrainingProgrammeFundingCap, group.CommonFundingCap); }
public void AndSingleApprenticeshipWithStartDateOutOfAllFundingBandsThenCommonFundingCapShouldNotBeSet() { var apprenticeships = new[] { new ApprenticeshipListItemViewModel { StartDate = new DateTime(1969, 7, 20) } }; var group = new ApprenticeshipListItemGroupViewModel(apprenticeships, _testTrainingProgramme); Assert.AreEqual(null, group.CommonFundingCap); }
public void AndOneApprenticeshipHasNoStartDateThenThereIsNoCommonFundingCap() { var apprenticeships = new[] { new ApprenticeshipListItemViewModel { StartDate = new DateTime(2020, 2, 2) }, new ApprenticeshipListItemViewModel { StartDate = null } }; var group = new ApprenticeshipListItemGroupViewModel(apprenticeships, _testTrainingProgramme); Assert.AreEqual(null, group.CommonFundingCap); }
public void AndTwoApprenticeships( int firstApprenticeshipCost, int secondApprenticeshipCost, bool expectedShowCommonFundingCap) { var apprenticeships = new[] { new ApprenticeshipListItemViewModel { StartDate = new DateTime(2020, 2, 2), Cost = firstApprenticeshipCost }, new ApprenticeshipListItemViewModel { StartDate = new DateTime(2020, 2, 2), Cost = secondApprenticeshipCost }, }; var group = new ApprenticeshipListItemGroupViewModel(apprenticeships, _testTrainingProgramme); Assert.AreEqual(expectedShowCommonFundingCap, group.ShowCommonFundingCap); }
public void AndApprenticeshipsHaveDifferentFundingCapsThenThereIsNoCommonFundingCap() { var apprenticeships = new[] { new ApprenticeshipListItemViewModel { StartDate = new DateTime(2020, 1, 1) }, new ApprenticeshipListItemViewModel { StartDate = new DateTime(2020, 2, 1) } }; _testTrainingProgramme = new TrainingProgramme { FundingPeriods = new List <TrainingProgrammeFundingPeriod> { new TrainingProgrammeFundingPeriod { EffectiveFrom = new DateTime(2020, 1, 1), EffectiveTo = new DateTime(2020, 1, 31), FundingCap = 100 }, new TrainingProgrammeFundingPeriod { EffectiveFrom = new DateTime(2020, 2, 1), EffectiveTo = new DateTime(2020, 2, 28), FundingCap = 200 } }, CourseCode = "abc-123", EffectiveFrom = new DateTime(2020, 1, 1), EffectiveTo = new DateTime(2020, 2, 28) }; var group = new ApprenticeshipListItemGroupViewModel(apprenticeships, _testTrainingProgramme); Assert.AreEqual(null, group.CommonFundingCap); }
public void AndNoTrainingProgrammeThenThereAreNoApprenticeshipsOverFundingLimit() { var group = new ApprenticeshipListItemGroupViewModel(_singleApprenticeship, null); Assert.AreEqual(0, group.ApprenticeshipsOverFundingLimit); }
public void AndNoTrainingProgrammeThenDontShowCommonFundingCap() { var group = new ApprenticeshipListItemGroupViewModel(_singleApprenticeship, null); Assert.AreEqual(false, group.ShowCommonFundingCap); }
public void AndNoTrainingProgrammeThenThereIsNoCommonFundingCap() { var group = new ApprenticeshipListItemGroupViewModel(_singleApprenticeship, null); Assert.AreEqual(null, group.CommonFundingCap); }