コード例 #1
0
        protected void SetupValidLearnersData(long ukprn, Learner learner)
        {
            learner.LearningDelivery.PriceEpisodes[0].Tnp1 = learner.LearningDelivery.StandardCode > 0 ?
                                                             learner.LearningDelivery.PriceEpisodes[0].TotalPrice * 0.8m :
                                                             learner.LearningDelivery.PriceEpisodes[0].TotalPrice;

            if (learner.LearningDelivery.StandardCode > 0)
            {
                learner.LearningDelivery.PriceEpisodes[0].Tnp2 = learner.LearningDelivery.PriceEpisodes[0].TotalPrice * 0.2m;
            }
            //Save File Details
            LearnerDataHelper.SaveFileDetails(ukprn,
                                              EnvironmentVariables);

            //Save Learning Provider
            LearnerDataHelper.SaveLearningProvider(ukprn,
                                                   EnvironmentVariables);

            //Save the Learner
            LearnerDataHelper.SaveLearner(ukprn,
                                          learner.Uln,
                                          learner.LearnRefNumber,
                                          EnvironmentVariables);

            //save Learner delivery
            LearnerDataHelper.SaveLearningDelivery(ukprn,
                                                   learner.LearnRefNumber,
                                                   learner.LearningDelivery,
                                                   EnvironmentVariables);

            //save learning delivery FAM
            LearnerDataHelper.SaveLearningDeliveryFAM(ukprn, learner.LearnRefNumber, learner.LearningDelivery.StartDate, learner.LearningDelivery.PlannedEndDate, EnvironmentVariables);

            LearnerDataHelper.SaveTrailblazerApprenticeshipFinancialRecord(ukprn, 1, learner.LearnRefNumber, learner.LearningDelivery.PriceEpisodes[0].Tnp1.Value, EnvironmentVariables);

            //save Trailblazer
            if (learner.LearningDelivery.PriceEpisodes[0].Tnp2.HasValue)
            {
                LearnerDataHelper.SaveTrailblazerApprenticeshipFinancialRecord(ukprn, 2, learner.LearnRefNumber, learner.LearningDelivery.PriceEpisodes[0].Tnp2.Value, EnvironmentVariables);
            }

            var months = ((learner.LearningDelivery.PlannedEndDate.Year - learner.LearningDelivery.StartDate.Year) * 12) +
                         learner.LearningDelivery.PlannedEndDate.Month - learner.LearningDelivery.StartDate.Month;

            learner.LearningDelivery.PriceEpisodes[0].MonthlyPayment    = learner.LearningDelivery.PriceEpisodes[0].TotalPrice * 0.8m / months;
            learner.LearningDelivery.PriceEpisodes[0].CompletionPayment = learner.LearningDelivery.PriceEpisodes[0].TotalPrice * 0.2m; //- ((learner.LearningDelivery.PriceEpisodes[0].TotalPrice * 0.8m) / months);

            //save the learning deliver values
            EarningsDataHelper.SaveLearningDeliveryValuesForUkprn(ukprn, learner.LearnRefNumber,
                                                                  learner.LearningDelivery,
                                                                  EnvironmentVariables);
        }
コード例 #2
0
        public void ThenTheCompletionPaymentIs(decimal completionPayment)
        {
            var environmentVariables = EnvironmentVariablesFactory.GetEnvironmentVariables();

            var learner = StepDefinitionsContext.GetDefaultProvider().Learners.First();
            var output  = LearnerDataHelper.GetOpaApprenticeshipPriceEpisode(StepDefinitionsContext.GetDefaultProvider().Ukprn,
                                                                             learner.LearnRefNumber,
                                                                             learner.LearningDelivery.StartDate,
                                                                             learner.LearningDelivery.PlannedEndDate,
                                                                             environmentVariables);


            Assert.IsNotNull(output, $"Expected AE Learning Delivery but nothing found");
            Assert.AreEqual(completionPayment, output.PriceEpisodeCompletionElement, $"Expected completion payment of {completionPayment} but found {output.PriceEpisodeCompletionElement}");
        }
コード例 #3
0
        public void ThenTheMonthlyEarningsIs(decimal monthlyEarnings)
        {
            var environmentVariables = EnvironmentVariablesFactory.GetEnvironmentVariables();

            var learner = StepDefinitionsContext.GetDefaultProvider().Learners.First();
            var output  = LearnerDataHelper.GetOpaApprenticeshipPriceEpisode(StepDefinitionsContext.GetDefaultProvider().Ukprn,
                                                                             learner.LearnRefNumber,
                                                                             learner.LearningDelivery.StartDate,
                                                                             learner.LearningDelivery.PlannedEndDate,
                                                                             environmentVariables);


            Assert.IsNotNull(output, $"Expected AE Learning Delivery but nothing found");
            Assert.AreEqual(monthlyEarnings, output.PriceEpisodeInstalmentValue, $"Expected monthly installment of {monthlyEarnings} but found {output.PriceEpisodeInstalmentValue}");
        }
        public void ThenTheFollowingCappingWillApplyToThePriceEpisodes(Table table)
        {
            for (var rowIndex = 0; rowIndex < table.RowCount; rowIndex++)
            {
                var provider = table.Rows[rowIndex].Contains("provider")
                    ? StepDefinitionsContext.GetProvider(table.Rows[rowIndex].Value <string>("provider"))
                    : StepDefinitionsContext.GetDefaultProvider();

                var priceEpisode                = provider.GetPriceEpisode(table.Rows[rowIndex].Value <string>("price episode"));
                var expectedNegotiatedPrice     = table.Rows[rowIndex].Value <decimal>("negotiated price");
                var expectedPreviousFunding     = table.Rows[rowIndex].Value <decimal>("previous funding paid");
                var expectedPriceAboveCap       = table.Rows[rowIndex].Value <decimal>("price above cap");
                var expectedPriceForSfaPayments = table.Rows[rowIndex].Value <decimal>("effective price for SFA payments");

                var actualPriceEpisode = LearnerDataHelper.GetOpaApprenticeshipPriceEpisode(provider.Ukprn, priceEpisode.Id, EnvironmentVariables);

                Assert.AreEqual(expectedNegotiatedPrice, actualPriceEpisode.PriceEpisodeTotalTNPPrice, $"Expecting a total negotiated price of {expectedNegotiatedPrice} for pride episode {priceEpisode.DataLockMatchKey} but found {actualPriceEpisode.PriceEpisodeTotalTNPPrice}.");
                Assert.AreEqual(expectedPreviousFunding, actualPriceEpisode.PriceEpisodePreviousEarnings, $"Expecting previous funding of {expectedPreviousFunding} for pride episode {priceEpisode.DataLockMatchKey} but found {actualPriceEpisode.PriceEpisodePreviousEarnings}.");
                Assert.AreEqual(expectedPriceAboveCap, actualPriceEpisode.PriceEpisodeUpperLimitAdjustment, $"Expecting a price above cap of {expectedPriceAboveCap} for pride episode {priceEpisode.DataLockMatchKey} but found {actualPriceEpisode.PriceEpisodeUpperLimitAdjustment}.");
                Assert.AreEqual(expectedPriceForSfaPayments, actualPriceEpisode.PriceEpisodeUpperBandLimit, $"Expecting an effective price for SFA payments of {expectedPriceForSfaPayments} for pride episode {priceEpisode.DataLockMatchKey} but found {actualPriceEpisode.PriceEpisodeUpperBandLimit}.");
            }
        }