Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public void AndNoApprenticeshipsThenThereAreNoApprenticeshipsOverFundingLimit()
        {
            var trainingProgram = new TrainingProgramme();

            var group = new ApprenticeshipListItemGroupViewModel(new ApprenticeshipListItemViewModel[0], trainingProgram);

            Assert.AreEqual(0, group.ApprenticeshipsOverFundingLimit);
        }
Esempio n. 4
0
        public void AndSingleApprenticeshipOverFundingLimitThenShowCommonFundingCap()
        {
            _singleApprenticeship.First().Cost = TestTrainingProgrammeFundingCap + 1;

            var group = new ApprenticeshipListItemGroupViewModel(_singleApprenticeship, _testTrainingProgramme);

            Assert.AreEqual(true, group.ShowCommonFundingCap);
        }
Esempio n. 5
0
        public void AndNoApprenticeshipsThenDontShowCommonFundingCap()
        {
            var apprenticeships = new ApprenticeshipListItemViewModel[0];

            var group = new ApprenticeshipListItemGroupViewModel(apprenticeships, _testTrainingProgramme);

            Assert.AreEqual(false, group.ShowCommonFundingCap);
        }
Esempio n. 6
0
        public void AndNoApprenticeshipsThenThereIsNoCommonFundingCap()
        {
            var apprenticeships = new ApprenticeshipListItemViewModel[0];

            var group = new ApprenticeshipListItemGroupViewModel(apprenticeships, _testTrainingProgramme);

            Assert.AreEqual(null, group.CommonFundingCap);
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
        public void AndNoTrainingProgrammeThenThereAreNoApprenticeshipsOverFundingLimit()
        {
            var group = new ApprenticeshipListItemGroupViewModel(_singleApprenticeship, null);

            Assert.AreEqual(0, group.ApprenticeshipsOverFundingLimit);
        }
Esempio n. 14
0
        public void AndNoTrainingProgrammeThenDontShowCommonFundingCap()
        {
            var group = new ApprenticeshipListItemGroupViewModel(_singleApprenticeship, null);

            Assert.AreEqual(false, group.ShowCommonFundingCap);
        }
Esempio n. 15
0
        public void AndNoTrainingProgrammeThenThereIsNoCommonFundingCap()
        {
            var group = new ApprenticeshipListItemGroupViewModel(_singleApprenticeship, null);

            Assert.AreEqual(null, group.CommonFundingCap);
        }